I'm afraid there's no solution yet
https://issues.apache.org/jira/browse/PDFBOX-922
https://issues.apache.org/jira/browse/PDFBOX-1242
Tilman
Am 15.07.2014 16:00, schrieb □?Tango□:
hi,PDFBox Support :
Your product is great, I loaded the local ttf file to
"contentStream" write Chinese characters, pdf files garbled, I ask how to solve?
---------------------
@Test
public void testLocalFont() throws IOException, COSVisitorException {
PDDocument document = null;
PDPageContentStream contentStream = null;
try {
document = new PDDocument();
PDPage page = new PDPage();
document.addPage(page);
//
PDFont font = PDTrueTypeFont.loadTTF(document, "方正大标宋简体.ttf");
//PDFont font = PDType1Font.HELVETICA_BOLD;
contentStream = new PDPageContentStream(document, page);
contentStream.beginText();
contentStream.setFont(font, 12);
contentStream.moveTextPositionByAmount(100, 700);
contentStream.drawString("方正大标宋简体");
contentStream.endText();
contentStream.close();
document.save("local-font-test.pdf");
} finally {
document.close();
}
}