2015-04-14

wkHTMLToPDF chinese character support on Linux based systems

This post will explain how to add support for Chinese characters in wkHTMLToPDF - the famous tool that converts HTML pages to PDF documents seamlessly. By default, if you have Chinese characters in your HTML page and convert the page to PDF with wkHTMLToPDF, nothing comes out (blanks replace chinese characters). I doubt this subject will be helpful to a lot of people around the world, but I might need to use this trick again in the future so why not blog about it?

The trick is to install Chinese character support on your OS and rebuild the cache. Under Ubuntu, I ran this command to install Chinese fonts:
apt-get install fonts-wqy-microhei ttf-wqy-microhei fonts-wqy-zenhei ttf-wqy-zenhei 
Note: package names might be different if you aren't under Ubuntu (try apt-cache search ... to search for packages)
Then, run this command to update the font cache:
fc-cache -f -v

After that, try generating a PDF again with wkHTMLToPDF: it works! Huge thanks to an anonymous user on StackOverflow for finding the solution.

4 comments:

Ankit said...

Thanks a lot...you saved my ass :)

baixar mobogenie said...

I think I need it. Thank you for update information. i like your blog.
----
i like play game click jogos online free and apply baixar facebook movel online free and apply mobogenie online free

descargar whatsapp gratis said...

This is a great article. It gave me a lot of useful information. thank you very much.
----
apply baixar facebook movel and descargar whatsapp gratis para android and apply baixar facebook gratis

fnaf 3 said...

You know how to involve a reader and increase his curiosity to read more.
----
five nights at freddy's download | fnaf | five nights at freddy's

Search This Blog

Loading...