cancel
Showing results for 
Search instead for 
Did you mean: 

Add Business Number to .PDF Invoice ?

Add Business Number to .PDF Invoice ?

Hi all,

 

Basically, need to add Business number somewhere on the .pdf generated invoice in Magento. 

It could be anywhere, top or bottom of the page.

Any help?

1 REPLY 1

Re: Add Business Number to .PDF Invoice ?

You can customize the invoice layout by modifying class Mage_Sales_Model_Order_Pdf_Invoice, which can be found at:app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php

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

 

You have to modify getPdf() function which renders complete invoice PDF, somewhere in foreach loop. That should be something like:

$page->drawText('Business Number: ' . $businessNumber, 35, 35, 'UTF-8');

Also, you can modify color/font by using:

$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
$this->_setFontRegular($page, 10);

But, the main function for adding data to PDF is drawText(), and it's easy to use because you have only to provide text, x and y coordinates. If you're not sure what coordinates to put there, you can just try couple of times until you find position you want.

public function drawText($text, $x, $y, $charEncoding = '')

 

 

If this response was helpful to you, consider giving kudos to this post.
If this response solved your problem, click accept as solution to help others solve this issue