Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Retrieving all fields from a PDF form

Sloey, James

2005-05-23

Replies:

Is there a way to retrieve all the form field names from a PDF file? I have to retrieve an unknown number of form fields from a PDF template and fill in the matching fields with data from an XML file.
 
I tried using...
 
//   Reads in the pdf Template
  PdfReader reader = new PdfReader(templatePath + template);
  PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(path+outfile));
  AcroFields form = stamp.getAcroFields(); 
  Collection fieldlist = form.getFields().values();
  for (Iterator i = fieldlist.iterator(); i.hasNext(); ) {
       System.out.println(i.next().toString());
  }
 
And I get ...
com.lowagie.text.pdf.AcroFields$Item@d70d7a
com.lowagie.text.pdf.AcroFields$Item@b5f53a
com.lowagie.text.pdf.AcroFields$Item@1f6f0bf
com.lowagie.text.pdf.AcroFields$Item@137c60d
 
Thanks for any help...
Jim Sloey
©2008 junlu.com - Jax Systems, LLC, U.S.A.