Write Chinese in pdf using Apache PDFBox

The default fonts in PDFBox do not support Chinese characters hence we need Unicode fonts for that. Lets see how to write Chinese in pdf using Apache PDFBox.

Exception using default fonts

If you try to write Chinese characters in a PDF using the any of the default fonts provided, then we get exceptions something like displayed below

To avoid this, we need to add a Unicode font while writing Chinese characters. I have used Arial Unicode. You can download it from here

Lets see an example using the Unicode fonts file and some Chinese words

Output
Write Chinese in pdf using Apache PDFBox

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn