Hello,
Maybe my title is a bit strange so I will try to tell my problem here.
I'm adding a footer to the PDF page with the following code:
[CODE]
<?php
ob_start();
$this_is_my_footer_tekst = "Hello this is my footer";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<script type="text/php">
if ( isset($pdf) ) {
$font = Font_Metrics::get_font("verdana");;
$size = 10;
$color = array(0,0,0);
$text_height = Font_Metrics::get_font_height($font, $size);
// Open the object: all drawing commands will
// go to the object instead of the current page
$footer = $pdf->open_object();
$w = $pdf->get_width();
$h = $pdf->get_height();
// Draw a line along the bottom
$y = $h - 2 * $text_height - 24;
#$pdf->line(16, $y, $w - 16, $y, $color, 1);
// Add an initals box
$text = $this_is_my_footer_tekst;
$pdf->text($w - 16 - $width - 38, $y, $text, $font, $size, $color);
#$pdf->rectangle($w - 16 - 36, $y - 2, 36, $text_height + 4, array
(0.5,0.5,0.5), 0.5);
// Close the object (stop capture)
$pdf->close_object();
// Add the object to every page. You can
// also specify "odd" or "even"
$pdf->add_object($footer, "all");
}
</script>
<!-- here is my html page that will be converter to pdf -->
</body>
</html>
<?php
$html = ob_get_contents();
ob_clean();
$pdfnaam = "Factuur.pdf";
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream($pdfnaam);
?>
[/CODE]
The problem is, is that my footer text is made outside the <script
type="text/php"></script> tags. By this the variable
$this_is_my_footer_tekst is not accessible in the script.
Does anyone know how to solve this?
Kind regards,