You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2014/10/11 01:29:36 UTC
[jira] [Updated] (PDFBOX-1071) Can not generate chinese character
PDF file
[ https://issues.apache.org/jira/browse/PDFBOX-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Hewson updated PDFBOX-1071:
--------------------------------
Fix Version/s: 2.0.0
> Can not generate chinese character PDF file
> -------------------------------------------
>
> Key: PDFBOX-1071
> URL: https://issues.apache.org/jira/browse/PDFBOX-1071
> Project: PDFBox
> Issue Type: Bug
> Components: Writing
> Affects Versions: 1.6.0
> Environment: Windows XP
> Oracle JDK 1.6
> Reporter: Linus Tseng
> Priority: Critical
> Labels: chinese
> Fix For: 2.0.0
>
> Attachments: fireflysung.zip
>
>
> 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");
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)