[dompdf] page number issue

753 views
Skip to first unread message

saeed ahmed

unread,
May 16, 2010, 5:43:32 PM5/16/10
to dompdf
I'm trying to add page number on the pdf. I have try the below code.
but couldn't get the page number at the pdf.
where I'm doing wrong. please suggest me.
<?php
require_once("dompdf_config.inc.php");

$dompdf = new DOMPDF();

$html = '<html><body>';
$html .='<script type="text/php">
$font = Font_Metrics::get_font("verdana", "bold");
$dompdf->page_text(200, 16, "{PAGE_NUM} of {PAGE_COUNT}", $font,
10, array(0,0,0)); </script>';
$html .= '</body></html>';


$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
?>

--
You received this message because you are subscribed to the Google Groups "dompdf" group.
To post to this group, send email to dom...@googlegroups.com.
To unsubscribe from this group, send email to dompdf+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dompdf?hl=en.

saeed ahmed

unread,
May 17, 2010, 12:45:35 PM5/17/10
to dompdf

BrianS

unread,
May 18, 2010, 4:48:30 PM5/18/10
to dompdf
On May 16, 5:43 pm, saeed ahmed <saeed....@gmail.com> wrote:
> I'm trying to add page number on the pdf. I have try the below code.
> but couldn't get the page number at the pdf.
> where I'm doing wrong. please suggest me.
> <?php
> require_once("dompdf_config.inc.php");
>
> $dompdf = new DOMPDF();
>
> $html = '<html><body>';
> $html .='<script type="text/php">
>                         $font = Font_Metrics::get_font("verdana", "bold");
>                         $dompdf->page_text(200, 16, "{PAGE_NUM} of {PAGE_COUNT}", $font,
> 10, array(0,0,0)); </script>';
> $html .=  '</body></html>';
>
> $dompdf->load_html($html);
> $dompdf->render();
> $dompdf->stream("sample.pdf");
> ?>
>

The object reference should be $pdf for inline script (not $dompdf).
See if fixing that helps.

saeed ahmed

unread,
May 18, 2010, 4:53:47 PM5/18/10
to dom...@googlegroups.com
thank you, its working now :)
Reply all
Reply to author
Forward
0 new messages