CiviCRM PDF Letters with Chinese/Japanese/Korean .. or Comic Sans MS fonts
CiviCRM by default uses the “dompdf” library for converting HTML content to PDF (ex: PDF Letters, invoices/receipts). DomPDF has some limitations, both for performance and font-support.
CiviCRM also supports “wkhtmltopdf”, a program based on WebKit (the web renderer in the Chrome browser).
Here’s how to configure support on the server for Korean. This assumes that you have a dedicated/virtual server with root access, running Debian or Ubuntu. This will not work in shared hosting.
On the server:
sudo apt-get install wkhtmltopdf xvfb xfonts-baekmuk ttf-baekmuk
IMPORTANT: if you are running Debian “Jessie”, the wkhtmltopdf is too old. You can install the latest version from http://wkhtmltopdf.org/downloads.html. Make sure you either have the version 0.12.13, or a version of wkhtmltopdf whose –version says “with qt patched”. This is not so much for the font support, but for general issues with the scaling of text and images.
On desktops for testing, you will need the fonts too
sudo apt-get install xfonts-baekmuk ttf-baekmuk
If you want to support silly fonts such as Comic Sans MS, you will need to enable the “contrib” source in /etc/apt/sources.list, and install:
sudo apt-get install msttcorefonts
In CiviCRM, in /civicrm/admin/setting/misc : configure the wkhtmltopdf path to:
/usr/bin/xvfb-run -- /usr/bin/wkhtmltopdf
Author Mathieu Lu