The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

corvax19 (1) [Avatar] Offline
#1
Dear Gurus,

I'm pleased to find such a cool and feature rich library to work with PDF.
My particular interest in iText (and any other similar library) is rather small:
just to fill forms with data. We have a bunch of templates (forms) and i need
to populate them with some text (lets say from DB).

No problem at allwith plain old English. But in Russia, English is not that popular yet and customer wants to see Cyrillics in his doc.
After doing some exercieses with that task, i come to the finish with no result.

So, if the authros could give answers to two simple questions:
1. is it possible at all with iText (on java)
2. could you, pls, reply with 10 lines demos - i beleave, this would be
an answers for the problem of hundreds users.

Thanks in advance!
And i promise, if there is a positive answer for both questions - i'll buy
another copy of the book in addition to mine (hardcopy this time) smilie

Thanks in advance !

Regards,
Romans
blowagie (284) [Avatar] Offline
#2
Re: Three russian letters of UTF8 in AcroFields
I'll give you 3 answers:

(1) set the font to a font that has the characters you need (without embedding the font). This will work on computers that have the same font on their system. It probably won't work on computers that don't know anything about that font. Use this if you have control over the environment (for instance: the form has only to be filled in by the administration of a company, not by external users).
(2) embed the font with the form. This is done in the example HelloWorldUnicode. You can find it on this page: http://itext.ugent.be/itext-in-action/chapter.php?chapter=20 If you try this example, you'll notice two things: you can fill the form with Chinese glyphs, BUT: the PDF file with the form is HUGE. ALL GLYPHS are embedded and that's usually not what you want or need. Either you take a smaller font or you use solution (3).
(3) what I usually do when I need an exotic font and I want to make sure that all the glyphs I need are present even if the PDF is transferred or used on another system, is to create a form and to add a field with default value "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789". Only a subset of the font with the glyphs corresponding with the characters in the above String is embedded. That way I'm sure the glyphs I need are present in the file and the size of the form remains acceptable. I have an example, but I'm currently at the hospital with my son and I'm working on a borrowed PC. I don't have that example here.

Note that solution (2) is also acceptable if you use a font that is smaller than arialunicode.

I see you are addressing the 'Gurus'. Unfortunately I am the only one answering questions on this forum. If you want to reach more gurus at once (or if you have any further question), please use the mailing list: itext-questions@lists.sourceforge.net
You'll have to subscribe, but you can find the necessary links here: http://www.1t3xt.com/about/contact.php