I have to look at the PDF file.

----- Original Message ----- 
From: "Russell Burke" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, October 24, 2005 8:42 PM
Subject: [iText-questions] Problem with updating form field values using
iText.


I'm having a problem saving PDF form text field values that I populated
using iText.  The code below opens a PDF file for input and creates another
for output with the updated text field values.  The problem is when I open
the output PDF file I get the error message "Wrong type parameter supplied
to a PDS procedure".  Once I clear the error message box I can view the
document with the correct updated field values.  Below is the sample code.
Is this the correct way to update a text field and save the changes to a
PDF?

PdfReader reader1 = new PdfReader("InputForm.pdf");

File updatedPDF = new File("UpdatedForm.pdf");




PdfStamper pdfStamper = new PdfStamper(reader1, new
FileOutputStream(updatedPDF.getAbsolutePath()));

AcroFields acroFields = pdfStamper.getAcroFields();


HashMap PDFFields = acroFields.getFields();

Set fieldNameKeys = PDFFields.keySet();


for ( Iterator fieldNames = fieldNameKeys.iterator();
fieldNames.hasNext(); )

{

   String fieldName = (String)fieldNames.next();

   if ( fieldName.indexOf("ApplicantName") != -1)

   {

   boolean isApplicantNameFieldUpdated = acroFields.setField( fieldName,
"Russell Burke");

   boolean isApplicantNameFieldFlattened =
pdfStamper.partialFormFlattening(fieldName);

   }

}



pdfStamper.setFormFlattening(true);

pdfStamper.close();




Thanks,
Russell Burke
CTG
Systems Advisor
[EMAIL PROTECTED]


----------------------------------------------------------------------------
----


> The information transmitted is intended only for the person or entity
> to which it is addressed and may contain confidential and/or
> privileged material. Any review, retransmission, dissemination
> or other use of, or taking of any action in reliance upon, this
> information by persons or entities other than the intended recipient
> is prohibited. If you received this in error, please contact the
> sender and delete the material from any computer.



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to