I am new to PDFBox, and I couldn't figure out how to write Chinese characters
to pdf file. With the code snippet below, the result pdf file displays some
squares and strange symbols, instead of the correct Chinese character. And
Acrobat Reader pops up a message, saying "The font '??' contains bad /Widths."
PDFont font = PDTrueTypeFont.loadTTF(document,
"C:\\Windows\\fonts\\simkai.ttf");
PDPageContentStream contentStream = new
PDPageContentStream(document, page);
contentStream.beginText();
contentStream.setFont(font, 12);
contentStream.moveTextPositionByAmount(100, 700);
contentStream.drawString("\u59D3");
contentStream.endText();
What am I missing? Is there a code sample for generating PDF files with Asian
characters?
Thanks!
-Jian