You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Harippriya Parameswaran (JIRA)" <ji...@apache.org> on 2013/04/17 09:37:15 UTC
[jira] [Created] (PDFBOX-1569) Chinese, Korean - MultiByte
Character displayed incorrectly
Harippriya Parameswaran created PDFBOX-1569:
-----------------------------------------------
Summary: 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.8.1, 1.8.0, 1.7.0
Environment: Java, Mac OS, Linux
Reporter: Harippriya Parameswaran
Priority: Blocker
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