pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkühler <andr...@lehmi.de>
Subject Re: Question about writing string to PDF with Slavic language.
Date Wed, 06 Nov 2013 10:56:08 GMT
Hi,


> HK Kim <julian.hk.kim@gmail.com> hat am 1. November 2013 um 16:42 geschrieben:
>
>
> Hi,
>
> I'm having trouble figuring out how to get Slavic language writing working;
> input I'm trying is:
>
> przesyłkiąęćktórże
>             PDSimpleFont font = PDType1Font.HELVETICA;
>
>             font.setFontEncoding(new PdfDocEncoding());
>
>             // PDSimpleFont font = PDTrueTypeFont.loadTTF(pdfDocument,
> newByteArrayInputStream(
> mFontBytes)); // tried importing multiple ttfs with no success
>
>             PDPageContentStream stream =
> newPDPageContentStream(pdfDocument, widget.getPage(),
> true, true);
>
>             stream.beginText();
>
>             stream.setFont(font, 10);
>
>             stream.moveTextPositionByAmount(lowerX, lowerY);
>
>             if (rotate)
>
>             {
>
>                 stream.setTextRotation(sNinetyDegreesInRadian, lowerX,
> lowerY);
>
>             }
>
>             stream.drawString(value);
>
>             stream.endText();
>
>             stream.close();
>
> It always comes out broken, or with gentium R102 ttf, it isn't broken but
> it comes out completely wrong.
>
>
> put it this way - if you had to write "przesyłkiąęćktórże" onto a pdf as a
> text at a random location on PDF, how would you go about it?
PDFBox doesn't support anything else but WinANSI encoded text.

We are working on UTF-8 support, see [1] for further details.

BR
Andreas Lehmkühler
[1] https://issues.apache.org/jira/browse/PDFBOX-922

Mime
View raw message