I added a footer to my invoices, this works fine.

private function _insertFooter($page) {

    $this->_setFontRegular($page, 8);

    $this->y = 100;
    $page->drawLine(25, $this->y, 570, $this->y);
    $this->y -= 15;

    $page->drawText('My Shop', 30, $this->y, 'UTF-8');
    $page->drawText('Address', 30, $this->y - 10, 'UTF-8');
    $page->drawText('ZIP City', 30, $this->y - 20, 'UTF-8');
    $page->drawText('Country', 30, $this->y - 30, 'UTF-8');
    $this->_setFontRegular($page, 10);


I add this function into the getPDF() function

/** * Return PDF document * * @param array|Collection $invoices * @return \Zend_Pdf */ public function getPdf($invoices = []) { $this->_beforeGetPdf(); $this->_initRenderer('invoice');

    $pdf = new \Zend_Pdf();
    $style = new \Zend_Pdf_Style();
    $this->_setFontBold($style, 10);

    foreach ($invoices as $invoice) {
    $this->_insertFooter($page); // <-- my footer stuff
    return $pdf;

Perfect, the footer is shown. But when there are several items in this invoice (so the table is too long), the product table overlaps the footer. I guess it would be easy to set page margins (like in html2pdf)... But how can I do that - I'm not fimilar with Zend yet. Or is this possible?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.