When I click to print an invoice in my magento admin panel, it downloads a file between 900K and 1.3MB (the variation seems random, I can't see a reason for it). This is a very simple Invoice with maybe 1 - 6 line items on it, so nothing that should make it take up more than 100K or so maximum.

Is there embedded fonts?

Could it be something on the serverside?

Is there a simple tweak I can make to reduce it?

I know with modern broadband etc it doesn't really matter, but it just seems a bit unnecessary.

3 Answers 3


Indeed the embedded fonts are responsible for the file size.

If you replace the font with a built in one, the file size for a simple invoice goes down to about 4kb.

To do that, it becomes a bit messy. You need to rewrite the classes extending from Mage_Sales_Model_Order_Pdf_Abstract and Mage_Sales_Model_Order_Pdf_Items_Abstract

Then, replace all calls to

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf');


$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);

The built-in fonts you can choose from are:

Zend_Pdf_Font::FONT_TIMES_ROMAN (or Zend_Pdf_Font::FONT_TIMES)

There are plenty of extensions that do that for you, for example https://github.com/firegento/firegento-pdf (also on Magento Connect) uses the built in FONT_HELVETICA.
The Firegento_Pdf extension makes customizing with the PDF's more pleasent in more then that regard by the way (plus, the default PDF's look nicer already).

  • Although this works on my magento 1.9.3 as described, it does not print "₹" in my invoices. Any suggestions?
    – Aakash
    Jul 20, 2017 at 4:10

This is one of those shake-fists-at-the-sky-and-yell-"MAGENTO!" moments. It's because of that ******* LinLibertine font which gets imbedded. See:

Changing this font is, IMO, one of the rare justifiable use cases of local code pool overrides of core classes. I prefer that approach to a "proper" rewrite of each and every sales PDF class just for the purpose of resetting the font, as it violates DRY.

  • 3
    I think Magento chose LinLibertine because it supports a wider range of unicode characters than the built-in fonts (plus it has a liberal license). If you end up with ? instead of expected characters you would need to chose a font which supports your locale. Jun 17, 2013 at 11:58
  • That's great info, @Fooman. It's the first time in 5 years I've heard a justification for the use of the font.
    – benmarks
    Jun 17, 2013 at 12:51
  • You'd think someone might add a checkbox - use LinLibertine or use Times New Roman! Thanks for the info.
    – Toby Allen
    Jun 17, 2013 at 16:01

It's Working for me !!

This bug appears to be happening for me on Magento installs on PHP 5.4 and above.


abstract public function __construct();


abstract public function __construct($filePath);

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.