Details
Description
I practice the PDF generate code for chinese character and load the chinese font ttf, but can not get the chinese PDF with correct display.'
The code is as below: The font coding is UTF-8
doc = new PDDocument();
PDPage page = new PDPage();
doc.addPage( page );
PDFont font = PDTrueTypeFont.loadTTF(doc, "d:\\temp\\ttf
fireflysung.ttf");
PDPageContentStream contentStream = new PDPageContentStream(doc, page);
contentStream.beginText();
contentStream.moveTextPositionByAmount(100, 700);
contentStream.setFont(font,12);
contentStream.drawString("中文測試");
contentStream.endText();
contentStream.close();
doc.save("d:\\temp
helloworld.pdf");
Attachments
Attachments
Issue Links
- duplicates
-
PDFBOX-922 True type PDFont subclass only supports WinAnsiEncoding (hardcoded!)
- Closed
- is related to
-
PDFBOX-903 Unicode text getting mangled via TextToPDF + PDFTextStripper
- Closed