You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2013/04/18 21:28:15 UTC

[jira] [Closed] (PDFBOX-1569) Chinese, Korean - MultiByte Character displayed incorrectly

     [ https://issues.apache.org/jira/browse/PDFBOX-1569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler closed PDFBOX-1569.
--------------------------------------

    Resolution: Duplicate
      Assignee: Andreas Lehmkühler

I'm afraid PDFBox doesn't support anything else but WinANSI encoded text when creating a PDF.

PDFBOX-922 already deals with this missing feature.
                
> Chinese, Korean - MultiByte Character displayed incorrectly
> -----------------------------------------------------------
>
>                 Key: PDFBOX-1569
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1569
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox, JempBox
>    Affects Versions: 1.7.0, 1.8.0, 1.8.1
>         Environment: Java, Mac OS, Linux
>            Reporter: Harippriya Parameswaran
>            Assignee: Andreas Lehmkühler
>            Priority: Blocker
>              Labels: Asian, Chinese, Languages
>         Attachments: Test.pdf
>
>
> While trying using Chinese Character to write to a PDF, it Displays incorrectly. Sample Code tried .
> Also tried with other TTF Files fireflysung.ttf,gbsn00lp.ttf, 金梅毛行书.TTF, SimSun.ttf . Have also tried Modifying the Encoding in PDTrueTypeFont.java loadTTF(PDDocument doc, InputStream stream) method.
>         PDDocument pdDocument = new PDDocument();
>         pdDocument.addPage(new PDPage());
>         BufferedImage bi = new BufferedImage(10, 10, 10);
>         Points point = new Points(300, 500);
>           @SuppressWarnings("unchecked")
> 	List<PDPage> list = pdDocument.getDocumentCatalog().getAllPages();
> 	PDPage pdPage = list.get(list.size() - 1);
> 	String fontPathName = "sazanami-gothic.ttf";
> 	PDFont fonta = PDTrueTypeFont.loadTTF(pdDocument,
> 	 Sample.class.getClassLoader()
> 	 .getResource(fontPathName).openStream() );		 
> 	
> 	PDJpeg ximage = new PDJpeg(pdDocument, bi);
> 	PDPageContentStream contentStream = new PDPageContentStream(pdDocument,
> 		pdPage, true, true);
> 	contentStream.beginText();
> 	contentStream.setFont(fonta,18);
> 	contentStream.moveTextPositionByAmount(point.getX(), point.getY() - 10 );
> 	contentStream.setNonStrokingColor(Color.black);
> 	contentStream.drawString("悲しい");
> 	contentStream.endText();
> 	contentStream.close();
> 	pdDocument.save("test/Test.pdf");
> 	pdDocument.close();	
> I also looked into other issues reported  PDFBOX-1071, PDFBOX-1302 , PDFBOX-491, PDFBOX-696,PDFBOX-725

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira