I am trying to print invoices with special characters (for example for a polish shop). By default these just get completely cut out. If I (for testing) enter only special characters as the customer's last name, the field in the invoice pdf is completely empty.

I made a new module overwriting the folllowing functions in \app\code\core\Mage\Sales\Model\Order\Pdf\abstract.php

protected function _setFontRegular($object, $size = 7)

protected function _setFontBold($object, $size = 7)

protected function _setFontItalic($object, $size = 7)

to use this font:

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/Fonts/Arial.ttf');

Also I created the folder 'Fonts' in 'lib' and copied the Arial.ttf inside.

The outcome: No effect at all, the pdf stays exactly the same (the module is active in the backend though).

So to make sure there's not just an error in the module somewehere else than in the actual code: I edited the abstract.php directly in \app\code\core\Mage\Sales\Model\Order\Pdf\, but unfortunately still with the same result.

What am I doing wrong?


Well actually I can answer this myself..

So if anyone got the same problem:

You can just upload your own fonts within the PDF Options in System -> Configuration -> Sales after Selecting 'yes' in the "upload own fonts" Dropdown. Still don't really understand why the code above doesn't work but however, this did the trick.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.