Hello Tan,
my answer will not make you happy. I asked similar question (
http://markmail.org/message/l6au7uo4ytt6zzlf) and got answer that UTF-8
support will be added with
https://issues.apache.org/jira/browse/PDFBOX-922. Vote on that issue
if you want to have it solved.

I ended up to use PdfClown library where it was easy to add UTF-8 text with
embedding TTF font into PDF document. The only problem I found with
PdfClown is that it doesn't support font subsetting and the resulting PDF
gets very big by embedding the whole TTF font. See my feature request
https://sourceforge.net/p/clown/feature-requests/14/.

The PDFBOX-922 ticket is the second most voted so hopefully it will be
added.

Sincerely,
Martin



2013/12/18 Tan YuQiang <[email protected]>

> I can write free text annotation with UTF-8 string  successfully, but when
> i use  PDPageContentStream  to draw UTF-8 string,  it is not written
> correctly.  why?
> My code is like below:
>         PDFont font = PDType1Font.TIMES_ROMAN;
>         contentStream.setFont(font, fontSize ); //PDPageContentStream
>          contentStream.moveTextPositionByAmount(x, y);
>          contentStream.drawString(info.getText());
>
> Thank you for any hint,
> Devin Tan
>
>
>
>
>
>
>

Reply via email to