Discussion:
[iText-questions] Cannot show special character in acro form field!
Eric Chow
2015-07-10 08:09:16 UTC
Permalink
Hello,

I tried to use the following code to set form field value with iText but it
could not show the character Ó§. The test-form-fill.pdf is created by Adobe
LifeCycle Form Designer. Please help!


InputStream is = new FileInputStream("doc/test-form-fill.pdf");
OutputStream os = new FileOutputStream("doc/test-form-fill-done.pdf");
PdfReader reader = new PdfReader(is);
PdfStamper stamper = new PdfStamper(reader, os);
AcroFields form = stamper.getAcroFields();

form.setField("field1", "Ó§11111");

stamper.setFormFlattening(true);
stamper.close();
reader.close();
is.close();
os.close();
Kostas
2015-07-13 07:20:37 UTC
Permalink
Hi.



I am not an expert, but probably you need to set the font for the form field to one that supports Unicode or just the language that this character belongs to.

I cannot remember the exact code for this right now, but there should be samples online.



I hope this helps. J





From: Eric Chow [mailto:***@gmail.com]
Sent: Friday, July 10, 2015 11:09 AM
To: Post all your questions about iText here
Subject: [iText-questions] Cannot show special character in acro form field!



Hello,



I tried to use the following code to set form field value with iText but it could not show the character Ó§. The test-form-fill.pdf is created by Adobe LifeCycle Form Designer. Please help!





InputStream is = new FileInputStream("doc/test-form-fill.pdf");

OutputStream os = new FileOutputStream("doc/test-form-fill-done.pdf");



PdfReader reader = new PdfReader(is);



PdfStamper stamper = new PdfStamper(reader, os);





AcroFields form = stamper.getAcroFields();



form.setField("field1", "Ó§11111");



stamper.setFormFlattening(true);

stamper.close();

reader.close();





is.close();



os.close();

Loading...