You must use the AcroFields from PdfStamper.
Best Regards,
Paulo Soares
-----Original Message-----
From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED] On Behalf Of USB ITEXT
Sent: Tuesday, February 17, 2004 1:38
To: [EMAIL PROTECTED]
Subject: [iText-questions] Question regarding populating PDF Form fields....
Hi,
I am using i-Text to read a PDF Form, populate the fields and flatten it before displaying the resultant PDF in the browser. The code is as follows:
String urlString = "<http://localhost:8080/fdfsample/PDFs/FormTest.pdf>";
resp.setContentType("application/vnd.fdf");
PdfReader reader = new PdfReader(new URL(urlString.toString()));
System.out.println("number of pages in pdf : " + reader.getNumberOfPages());
AcroFields afields = reader.getAcroFields();
HashMap fieldsHM = afields.getFields();
System.out.println("number of fields : " + fieldsHM.size());
afields.setField("txtFirstName","FirstName");
I am getting the error as below on the line where the field "txtFirstName" is being set:
[2/16/04 17:25:30:914 PST] 6a609e03 WebGroup E SRVE0026E: [Servlet Error]-[FDFServlet]: com.lowagie.text.DocumentException: This AcroFields instance is read-only.
at com.lowagie.text.pdf.AcroFields.setField(Unknown Source)
Can anyone help me to figure out the error I am making.
Thanks in advance for your help.
_____
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online <http://us.rd.yahoo.com/evt=22055/*http://taxes.yahoo.com/filing.html>