Hi Leonard,

The forms are all created with Acrobat 8 and 9 Pro.  Taking measures to
preserve case sensitivity with the form field names is the solution to the
problem I had.  It works fine as long as the you keep case consistent.

Thanks!


Leonard Rosenthol-3 wrote:
> 
> Is the form you are working with an AcroForm or an XFA form?
> 
> Leonard
> 
> -----Original Message-----
> From: transact [mailto:merr...@transact.com] 
> Sent: Wednesday, December 02, 2009 7:21 PM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] Problem Renaming Fields with iText and
> ColdFusion 9
> 
> 
> I am working on a tool that will allow users to rename form fields by
> pulling
> the current form fields out of the PDF and then displaying an HTML form
> containing the old name and a text input for the new name.  When the form
> is
> submitted, I loop through the form fields and rename each form field that
> has a new name.
> 
> This is working fine if the existing field name is a number and I change
> it
> to another number but it fails if the field name contains text.  For
> example, "1" would easliy be renamed to "11" but "field1" cannot be
> renamed
> to "field11".  The fact that the field name contains text is causing the
> renameField method to return false.
> 
> If anyone has any ideas on what to try, I would appreciate it.  Here is
> the
> code I'm using:
> 
> <cfset pdfReader = createObject("java", "com.lowagie.text.pdf.PdfReader")
> />
> <cfset outputStream = createObject("java", "java.io.FileOutputStream") />
> <cfset pdfStamper = createObject("java",
> "com.lowagie.text.pdf.PdfStamper")
> />
> <cfset pdfWriter = createObject("java", "com.lowagie.text.pdf.PdfWriter")
> />
> 
> <cfset pdfReader.init(fullPathToInputFile) />
> <cfset outputStream.init(fullPathToOutputFile) />
> <cfset pdfStamper.init(pdfReader, outputStream) />
> 
> <cfset thisForm = pdfStamper.getAcroFields() />
> <cfset strFormFields = thisForm.getFields() />
> 
> <cfset original_field = JavaCast("string", arguments.oldFieldName) />
> <cfset new_field = JavaCast("string", arguments.newFieldName) />
> 
> <cfif original_field neq new_field>
>     <cfset renameresult = thisForm.renameField(original_field, temp_field)
> />
>     <cfset renameresult = thisForm.renameField(temp_field, new_field) />      
> </cfif>
> 
> <cfset pdfStamper.close() />
> <cfset outputStream.close() />
> 
> THANK YOU!
> 
> 
> 
> -- 
> View this message in context:
> http://old.nabble.com/Problem-Renaming-Fields-with-iText-and-ColdFusion-9-tp26618805p26618805.html
> Sent from the iText - General mailing list archive at Nabble.com.
> 
> 
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing. 
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
> 
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing. 
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Problem-Renaming-Fields-with-iText-and-ColdFusion-9-tp26618805p26636153.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to