I am working with Codeigniter and I successfully implemented dompdf for generating PDF files. Now I have issues on adding a header and footer in generated PDF.
Here
I have also tried to add PHP code into the html but have never got a chance to make it work. here is the complete inline code which I guarantee works:
require_once("dompdf_config.inc.php");
$html ='
Hello Hello
Hello Hello 2
Hello Hello 3
';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$canvas = $dompdf->get_canvas();
$font = Font_Metrics::get_font("helvetica", "bold");
$canvas->page_text(72, 18, "Header: {PAGE_NUM} of {PAGE_COUNT}", $font, 6, array(0,0,0));
$dompdf->stream("my_pdf.pdf", array("Attachment" => 0));
?>