Call AcroFields.addSubstitutionFont() with a font with the Russian
glyphs, like arial.ttf, and then set the field.
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of markquest
> Sent: Tuesday, July 15, 2008 12:17 PM
> To: [email protected]
> Subject: [iText-questions] Problems replacing tokens in
> Foreign text extracted from an acrofield
>
>
> Hi,
> I have a PDF containing various acrofields. Each acrofield
> contains default
> text in Russian with some tokens embedded in it (i.e.
> <<<FirstName>>>).
> Within my java code I read the acrofield default text into a
> string, attempt
> to replace the tokens within the String with my own text, and
> then write it
> back into the text of the acrofield.
> This does not work with Russian text at all, al I get is the
> English tokens
> (not replaced) written back to the acrofield text.
> It works correctly if I use all English text in the
> acrofield default text
> with the tokens replaced accordingly
> Example of my code
> // employ iText api to generate pdf document
> FileOutputStream generatedDocStream = new
> FileOutputStream(generatedDocFullPathString);
> PdfReader reader = new PdfReader(templateFullPathString);
> PdfStamper stamp = new PdfStamper(reader, generatedDocStream);
> AcroFields form = stamp.getAcroFields();
> Map allFields = form.getFields();
> Iterator itx = allFields.keySet().iterator();
> while (itx.hasNext()) {
> String keyx = (String)itx.next();
> Iterator it =
> inputData.keySet().iterator();
> while (it.hasNext()) {
> String key =
> (String)it.next();
> String replacementString =
> (String)inputData.get(key);
> String newString =
> form.getField(keyx).replace(key, replacementString);
> form.setField(keyx, newString);
> }
> }
> Has anybody any ideas on how I could do this?
> Cheers!
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar