简体   繁体   中英

iText, unicode characters and Java

I have a text editing program that saves it's output into a PDF file.

It also saves all the text into a PDF dictionary from which it can be read back again. The problem is that in my native language characters like č,ć,đ,ž,š are pretty common...

When I write those characters in my programs GUI, it's fine, they all apear (I'm (currently) using java's arial font).

When I save it and open the PDF I AdobeReader, č i ć are missing and đ, ž and š are printed as they should. I am using a custom (truetype) font (BookAntiqua, downloaded from here .

Is this a problem in encoding, or in the font itself (that it does not support the đ, ž, š characters)?

Also, when I load the PDF into my program again, missing letters are still missing and đ, ž, š are swaped with ⎕ symboles and similar... Is that a problem in how PDF is written or is there something else?

Bottom line is, I'd like that those five charactes are visible in my programs GUI and in PDF document and that they are retrieved properly from PDF's dictionary.

I had the same problem. I have solved with changing a font which support those letters, forgot the name, maybe Arial unicode? - need to experiment what font is that- than I have embedded that font into pdf. That was perfect. My name has some of those strange characters :)

Edit: There is a sample here how to do it, and set it for fields too, and here another code snippet, which can be helpfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM