Hello,

i want to write a value into a hidden field and after that simply reading this value out of the pdf. My code looks like the following:

Document doc = new Document();
PdfWriter pdfWriter = null;
try {
 pdfWriter = PdfWriter.getInstance(doc, new FileOutputStream("test.pdf"));

 doc.setPageSize(PageSize.A4);
 doc.open();

 PdfAcroForm acroForm = pdfWriter.getAcroForm();
 PdfFormField hiddenField =     acroForm.addHiddenField("Hello", "World");
} catch(Exception e) {
 e.printStackTrace();
}

doc.close();

//reading
PdfReader reader = new PdfReader(new FileInputStream("test.pdf"));
PRAcroForm form = reader.getAcroForm();
ArrayList fields = form.getFields();
for (int i = 0; i < fields.size(); i++) {
 FieldInformation info = (FieldInformation) fields.get(i);
             System.out.println(info.getName());
       }

This code simply prints "Hello". But i haven't found a way to get to the "World"-value.
Anybody has an idea?

Greets,
Alex Bischof


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to