Ah... Yeah. That requires parent-child fields. Sounds (and looks, from the source) like iText doesn't handle that for you. This will require some low-level PDF manipulation on your part.
1) Convert the original "First_Name" into a field-thats-not-a-widget. You might not actually have to change the PdfDictionary at all, but you /do/ have to remove it from it's page's annotation array, to be replaced by one of its soon-to-be-many children. Just to be tidy however, you should remove anything to do with how the field looks, plus a couple others: /Type, /Subtype, /Rect, /AP, /MK, /DR, /DA, /F, /BS... sheesh. Quite a bit of stuff. You then add a /Kids array to the soon-to-be-parent field. Each entry in that array will be a reference to a widget annotation that displays the field. Each kid will have a /Parent reference pointing to First_Name. They must NOT have a /V, /DV, and they don't need to have a /T (value, default value, and title, respectively). If you do give them titles, they must be unique. A quick-n-dirty implementation could modify the AcroFields.Item.widget dictionaries you want to rename, removing the /V, /DV, and /T, and adding a /Parent reference to the parent "First_Name". This would leave the AcroFields object in an Invalid State, but I don't know that you can write to it from outside the .pdf package anyway. This could be an issue during flattening (and possibly a couple other places), but if you're not using that feature, I don't think it'll be a problem. Maybe. Kinda. A Proper implementation would actually do most of this work inside rename, along with correcting the AcroFields Items involved (dropping some and adding additional indexes to the main parent). --Mark Storer Senior Software Engineer Cardiff.com #include <disclaimer> typedef std::Disclaimer<Cardiff> DisCard; > -----Original Message----- > From: transact [mailto:[email protected]] > Sent: Wednesday, February 17, 2010 2:08 PM > To: [email protected] > Subject: Spam: Spam: Re: [iText-questions] Issue renaming fields with > PDFStamper > > > > Yes. I do want the form fields to have the same value > because in my case, > the fields I want to reuse are ones like 'FirstName' that should be > consistent across pages. > -- > View this message in context: > http://old.nabble.com/Issue-renaming-fields-with-PDFStamper-tp 27628665p27631084.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ iText-questions mailing list [email protected] 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/ ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ iText-questions mailing list [email protected] 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/
