Saturday, 6 February 2016

Change Fonts Size for PDF Invoice in Magento


Navigate to app/code/core/Mage/Sales/Model/Pdf and then copy Abstract.php, Creditmemo.php, Invoice.php, and Shipment.php files to app/code/local/Mage/Sales/Model/Pdf.

Now open up Abstract.php and find the following code around line 562:

protected function _setFontRegular($object, $size = 7)
 {
 $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertineC_Re-2.
8.0.ttf');
 $object->setFont($font, $size);
 return $font;
 }

 protected function _setFontBold($object, $size = 7)
 {
 $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertineC_Re-2.8.0.ttf');
 $object->setFont($font, $size);
 return $font;
 }

 protected function _setFontItalic($object, $size = 7)
 {
 $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertineC_Re-2.8.0.ttf');
 $object->setFont($font, $size);
 return $font;
 }
Change protected function _setFontRegular($object, $size = 7) 
size to any you want to all three functions.

No comments:

Post a Comment