Krishna G wrote:

Hello,

I have a windows application that fills the fields in
a pdf form. I am mimicking that using field_merge.java and then use ListFields.java (Both
these java programs are obtained from
iText examples in Paulo Soares's website) to view the filled in value and all the field
information associated with a field.
When I use the resulting pdf of field_merge.java as
ListFields input, it does not show any results.
When I try with some other sample pdfs it gives me the
output. Is it because of the PdfStamper used in field_merge.java to write to pdf? If so is there any other function which does the same and give results when run with
ListFields?

ListFields isn't exactly the most recent code.
Let me give you a little update:

This is how you set the content of a field:
stamper = new PdfStamper(reader, new FileOutputStream("result.pdf));
form = stamper.getAcroFields();
form.setField("name", "Bruno");
stamper.close();

This is how you can read the content of this field:
reader = new PdfReader("result.pdf");
form = reader.getAcroFields();
System.out.println(form.getField("name"));

Note that:
AcroFields.Item item = form.getFieldItem("name");
gives you a lot more info on the characteristics
of the field! (But that's rather advanced stuff.)

My guess is that you have flattened the field,
using stamper.setFormFlattening(true);
This adds the CONTENT of the field to the
PDF document(in this case my first name) ,
but it removes the FIELD (the AcroForm
structure). When a form is flattened, it is no
longer a form; getAcroFields() will not give
you any information on the fields that were
filled in.

br,
Bruno

br,
Bruno


-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to