Hi,

I am trying to create PDFs in languages such as Chinese and Russian but the 
characters of those languages are not being printed correctly.

This code outputs the attached PDF.

I read it has something to do with PDF not supporting UTF-8, I tried to use a 
font which had those characters but it didn’t work.


String text = "ру́сский язы́к, ру́сский язы́к, ру́сский язы́к";

PDDocument document = new PDDocument();

PDPage page = new PDPage();

document.addPage(page);

PDFont font = PDType1Font.HELVETICA_BOLD;

PDPageContentStream contentStream = new PDPageContentStream( document, page);

contentStream.beginText();

contentStream.setFont(font, 12);

contentStream.moveTextPositionByAmount(100, 700);

contentStream.drawString(text);

contentStream.endText();

contentStream.close();

document.save("Hello World.pdf");

document.close();

Does PDFBox supports printing this type of characters ? How can this be done ?


Thanks in advance!


Felipe
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to