I am creating invoices for our store in the Czech Republic, and neither UTF-8 nor ISO-8859-1 is returning the correct characters. UTF-8 is omitting characters, and ISO-8859-1 is returning the wrong characters.

From what I can tell, those are my only two options for creating PDF documents...

Any ideas on how I can get the correct character sets inside PDFs?

  • 1
    Which part of the invoice does this relate to? I would start debugging by checking the source field of the missing characters in the database. From there you would know if there is some wrong encoding happening in the pdf creation or if the wrong encoding happened earlier. Jun 16, 2013 at 15:23
  • It is def the pdf portion, the encodings work with html, however, they do not work when creating a pdf Jul 17, 2013 at 16:51
  • The used characters exist in UTF-8 I assume? UTF-8 is the format you want to use, magento uses it and normally there is no problem. What is the problem? Product names wrong? Aug 20, 2013 at 12:20

1 Answer 1


I had a similar issue with Japanese characters in the PDFs, and this was what solved the issue for me:

First, the default font in Magento did not support the characters that I was using. I needed to change the font to something else. Fortunately, Magento does come with another font that does support those characters. I used the ArialUni font located at lib/tcpdf/fonts.

To have Magento use this font for the PDFs, you will need to copy Mage_Sales_Model_Order_Pdf_Abstract to app/code/local/Mage and modify the _setFontRegular(), _setFontItalic(), and _setFontBold() functions to use the new font.

Next, you will need to fix a transliteration bug in Zend that fails when using this font. Make a local override of Zend_Pdf_FileParser and modify the definition of readStringMacRoman(). The iconv() function call parameter 1 should use the proper encoding id of "macintosh" instead of the encoding name of "MacRoman".

Normally I wouldn't create a local Mage override. I would make a new module and override via the config.xml. This is a unique case because the functions we need are defined in the abstract class, and Magento's override system does not allow us to override abstract classes. Our other option would be to make an override of all the classes that extend this abstract and change the function definition in all of those classes. So given the choice between modifying 6 or so classes and modifying one class, I'll modify the one.

Keep in mind that this approach will change the font (and thus the look) of all of your email PDFs.

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.