I'm using laravel framework in php.
I have Generated the plugin by using this barryvdh/laravel-dompdf
And now my question is how to create the page number for seprate page in pdf like page 1 and page 2 like this in barryvdh/laravel-dompdf
?
<?php
require_once("dompdf_config.inc.php");
$html =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
?>
For the page count you can use CSS counters.
<html>
<head>
<style>
.page-num:before { content: counter(page); }
</style>
</head>
<body>
<p>Page <span class="page-num"></span></p>
</body>
</html>
Unfortunately dompdf does not yet support the total number of pages using counters (for text similar to "page 1 of 3"). For that you would have to use script.
<?php
require_once("dompdf_config.inc.php");
$html = '...';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$pdf = $dompdf->get_canvas()->get_cpdf();
$x = 10; // from left
$y = 10; // from bottom
$text = "Page {PAGE_NUM} of {PAGE_NUM}"; // {PAGE_NUM} and {PAGE_COUNT} are placeholders populated by dompdf
$font = Font_Metrics::get_font("arial", "normal");
$size = "10"; // in pt
$color = array(.3, .3, .3); // rgb, valid values are between 0 and 1
$pdf->page_text($x, $y, $text, $font, $size);
$dompdf->stream("sample.pdf");
?>
Note: the above script snippet is specific to v0.6.x using the CPDF backend.