Can anybody tell me how we can add Page numbers to each page of the invoice pdf?
I want to add the page numbers in the footer.
Can anybody tell me how we can add Page numbers to each page of the invoice pdf?
I want to add the page numbers in the footer.
You can get the number of pages in the pdf using $pdf->pages
and loop through them increasing the index and rendering them at the same time. Something as follows;
$number_pages = sizeof($pdf->pages);
foreach($pdf->pages AS $key => $page) {
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
$page->drawText(($key + 1) . "/$number_pages", 540, 15, 'UTF-8');
}