1

Can anybody tell me how we can add Page numbers to each page of the invoice pdf?

https://nimb.ws/rcNG8B

I want to add the page numbers in the footer.

1 Answer 1

1

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');
}
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.