php - How to add Header and Footer in Dompdf?
78
I am generating a html2pdf using Dompdf and my code is
$html='<div>--content of pdf--</div>';
require_once('resources/dompdf/dompdf_config.inc.php');
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$output = $dompdf->output();
$dompdf->stream("transaction.pdf");
My pdf generated successfully now i want to add image in header of that pdf so can any one tell me how can i insert header and footer for Dompdf and specially where to put the header code?
Answer
Solution:
From dompdf FAQ
EDIT :
Here are step by step instructions:
Somewhere in your html file, near the top, open a script tag with a "text/php" type:
Check if the $pdf variable is set. dompdf sets this variable when evaluating embedded PHP.