wkhtmltopdf on Ubuntu/Debian - support Chinese, Japanese and Korean characters

This short post will explain how to add support for Chinese, Japanese and Korean characters in wkhtmltopdf. wkhtmltopdf is command line tools to render HTML into PDF using the Qt WebKit rendering engine. By default, Ubuntu/Debian don't support this characters - when you convert HTML page to PDF with wkhtmltopdf, nothing comes out - only blanks replace chinese characters. Reading Ubuntu help (see: Fonts) you must install this fonts and rebuild font cache. Under Ubuntu run this command to install Chinese fonts:

$ apt-get install ttf-wqy-microhei ttf-wqy-zenhei

Next, run this command to update the font cache:

$ fc-cache -f -v

After that, Ubuntu and wkhtmltopdf generating a PDF with proper Chinese characters.

Comments