For people coming here using the new version of DomPdf
Since dompdf 0.7.0 , the dompdf_config.inc.php file dompdf_config.inc.php been deleted (and there is no longer link): all dompdf parameters must be set at runtime.
This means that you need to create a new instance of the Options class
$domPdfOptions = new Options();
And then you can enable inline PHP using the following line
$domPdfOptions->set("isPhpEnabled", true);
Other codes are correct and will show page number and page count
<script type="text/php"> if (isset($pdf)) { $x = 72; $y = 18; $text = "{PAGE_NUM} of {PAGE_COUNT}"; $font = $fontMetrics->get_font("helvetica", "bold"); $size = 6; $color = array(255,0,0); $word_space = 0.0; // default $char_space = 0.0; // default $angle = 0.0; // default $pdf->page_text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle); } </script>
Update As @ london-smith noted, this also works for DomPDF 0.8.1
Erenor paz
source share