You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Linus Tseng (JIRA)" <ji...@apache.org> on 2011/07/19 10:13:58 UTC

[jira] [Created] (PDFBOX-1071) Can not generate chinese character PDF file

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
         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 is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (PDFBOX-1071) Can not generate chinese character PDF file

Posted by "Linus Tseng (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Linus Tseng updated PDFBOX-1071:
--------------------------------

    Attachment: fireflysung.zip

Chinese TTF

> 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
>         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 is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira