-I'm using Civicrm 5.11.0, Joomla 3.8.0, Windows 7
-SQL is encode in utf8
-Chinese characters in phpmysql are readable
-Chinese characters in Civicrm are readable
-Civicrm saves data in utf8, so import or export contacts in Chinese is fine
-CiviMail can send email with Chinese characters
-Win 7 can read Chinese characters and save word documents in pdf as Chinese
-but when I go to Individual>Contribution>Print Invoice as PDF, they all turn to question marks (one character, one question mark)
-put Chinese characters in invoice templates, turns to question marks too

I tried to change this code

   $dompdf->load_html( $html );

to this

   $dompdf->load_html( utf8_decode( $html ) );

(from ../civicrm/CRM/Utils/PDF/Utils.php)

but nothing happened, still question marks.
What could be the cause of this?

I also tried this on demo site, same results display.
enter image description here enter image description here


1 Answer 1


DOMPDF in CiviCRM have a trouble with special characters UTF-8. We have this same problem in Poland. I've create a repo with solution: https://github.com/ngo360/civicrm.dompdf.utf8

For apply this change go to path: path/to/civicrm/vendor/dompdf and delete all files. Then upload files from repo. I think is resolve Your problem.

  • Thanks. Wondering do you still need to edit print.css as described at civicrm.stackexchange.com/questions/27735/… or does this always enforce dejavu?
    – Demerit
    Commented Mar 28, 2019 at 23:37
  • I only change this files - its works well. I don't make any changes in print.css It's simple pack for fix this issue. :) Commented Mar 29, 2019 at 12:16
  • Ok upon examine again on dompdf\lib\fonts folder i noticed there was a ufm ,ufm.php and afm files generated for simsun, but it's named with some random numbers. So I changed those names to simsun, removed the @font code in print.css, rename the number font name represent as simsun in dompdf_font_family_cache.php, now it's working nice and clean! Commented Apr 1, 2019 at 3:22
  • Hi Jennifer - how did you get simsun font into the dompdf\lib\fonts folder? Where did you download it from? -- KarinG Commented Sep 6, 2021 at 16:00

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.