Tuesday, 9 December 2014

Add footer in pdf invoice magento


Add footer in pdf invoice magento

Here i will explain you how to draw footer in pdf invoice. First of open the Invoice.php file.

app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php

Copy below function and paste it in invoice.php at last.

protected function _drawFooter(Zend_Pdf_Page $page)
    {
        /* Add table foot */
        $this->_setFontRegular($page, 8);
        $this->y -= 10;
        $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
$page->drawLine(25, $this->y-20, 570, $this->y-20);

        $page->drawText(Mage::helper('sales')->__('Amount Chargeable including sales Tax/Vat Applied as per Ankleshwar Govt.'), 35, $this->y-50, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('Company VAT/TIN :'), 35, $this->y-65, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('XXXXXXXX'), 175, $this->y-65, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('Company PAN :'), 35, $this->y-80, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('XXXXXXXXX'), 175, $this->y-80, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('Registered Address :'), 35, $this->y-95, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('2/1970, Rudarpura, malifalia, Surat - 395002(INDIA)'), 175, $this->y-95, 'UTF-8');

$page->drawText(Mage::helper('sales')->__('This is a system generated receipt.Signatures are not required'), 340, $this->y-110, 'UTF-8');

$page->drawLine(25, $this->y-130, 570, $this->y-130);

    }

Now put this line in getPdf() function after totals block

$this->_drawFooter($page);

Now check your PDF Invoice and Enjoy Chandresh rana's Coding....

8 comments:

Unknown said...

How can I check an invoice without make a purchase?

PHP Coder said...

Without purchase you cant...

Alberto Dominguez said...

Hi, this position the text from top to bottom, so if there are multiple item lines the footer will desapear, how can i change it from bottom tu top position.

Anonymous said...

Thank you brother.
You saved my day.

Anonymous said...

Hi,

How i can add footer in last page only, if there are 2 or more pages,


Thanx

Unknown said...

Thank you Rana ji! This was a great help.

Unknown said...

Thank you bro :) working like charm

Unknown said...

Works Perfectly. Thanks so much