iText doesn't support forms created with Designer 7. Forms created with Acrobat 7 will work ok.

----- Original Message ----- From: "Rob Dickey" <[EMAIL PROTECTED]>
To: <itext-questions@lists.sourceforge.net>
Sent: Wednesday, November 23, 2005 11:20 PM
Subject: [iText-questions] Newbie to PDF APIs ? Trying to update fields...


I've reviewed some of the samples that use the PDFStamper, AcroFields, etc. objects to programmatically update fields from a PDF template and stream the update to a new PDF. The samples work great. However, when I tried the same
things against a PDF template I created using Adobe Designer, the fields
could not be referenced by name as done in the samples. It appears that the
fields are embedded in a tree (I assume the Cos Layer).  A debug statement
after instantiating the PDFStamper shows fields as follows:



Fields info:
{TopmostSubform[0].#subform[0].#subform[10].#subform[16].#field1[1]=com.lowa
[EMAIL PROTECTED],
TopmostSubform[0].#subform[0].#subform[1].#subform[9].#field2[2]=com.lowagie
[EMAIL PROTECTED], etc.



Code Excerpt:



     PdfReader reader = new PdfReader("TestTemplate.pdf");

     PdfStamper stamper = new PdfStamper(reader, new
FileOutputStream("TestOut.pdf"));

     AcroFields form1 = stamper.getAcroFields();

     System.out.println("Fields info: "+form1.getFields().toString());

//    writer = PdfWriter.getInstance(document,new
FileOutputStream("bidNotice"+bidNotice.getBidNoticeId()+".pdf"));

     form1.setField("field1","Test1");

     form1.setField("field2", "Test2");

     stamper.close();



Again, sorry for the newbie kind-of-question; in reviewing the template used
in the sample vs the template I created, my template certainly has more
involved in terms of tables. Embedded form fields, etc.  Is there another
object(s) of iText I should use to traverse the document tree to get to the field nodes? The sample template PDF was "hierarchy flat" so the references
to a specific field didn't involve subforms, etc.



TIA for any info.



Regards.







-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to