wkHTMLToPDF chinese/japanese/korean character support on Linux based systems

This post will explain how to add support for Chinese or Japanese or Korean 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

For Japanese and Korean please use those:
https://help.ubuntu.com/community/Fonts#Chinese.2C_Japanese.2C_and_Korean_Fonts

ttf-wqy-microhei - A droid derived Sans-Seri style CJK font
ttf-wqy-zenhei - "WenQuanYi Zen Hei" A Hei-Ti Style (sans-serif) Chinese font
ttf-dejima-mincho - antique-looking Japanese TrueType Mincho font
ttf-umefon - Japanese TrueType font, Ume-font
ttf-takao, ttf-takao-gothic, ttf-takao-mincho, and ttf-takao-pgothic - Japanese TrueType font set: Takao Fonts, Takao Gothic Fonts, Takao Mincho Fonts, and Takao P Gothic Fonts.
ttf-kochi-gothic and ttf-kochi-mincho - Kochi Subst Gothic and Mincho Japanese TrueType font without naga10
ttf-sazanami-gothic and ttf-sazanami-mincho - Sazanami Gothic and Mincho Japanese TrueType font (legacy)
ttf-nanum-coding - Nanum Coding fixed width Korean TrueType font
fonts-nanum and fonts-nanum-extra - Nanum and additional Nanum Korean fonts
ttf-baekmuk - Baekmuk series Korean fonts
After that, try generating a PDF again with wkHTMLToPDF: it works! Huge thanks to an anonymous user on StackOverflow for finding the solution.

Comments

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

Popular posts from this blog

Affiliate module for Interspire Shopping Cart

How to fix: Outlook on iOS/iPhone: "No Internet Connection"

Dealing with Nginx 400 Bad Request HTTP errors