Gents, I use PdfStamper to flatten forms/free text and then typically perform other operations using either PdfWriter or PdfCopy. This has been working fine until recently when a customer complained that text fields in an AcroForm were missing after flattening the form.
Upon investigating, I found that the Fields array of the AcroForm was empty. The form does not get flattened because PdfStamper thinks there is nothing to do. To my surprise, neither Acrobat nor the FoxIt Reader complain about this - presumably because the Widget Annot is referenced by the Page object. Enclosed is a small file that I created by iText to illustrate the problem. I have deliberately erased the contents of the Fields array (it was '3 0 R') of the AcroForm (object 7) to simulate the user data. Here's the interesting part - not only does the file display fine, but if you use Acrobat to extract that page, it is smart enough to properly re-construct the Fields array in the process. This brings up a couple of questions: 1. Is it valid to not reference Widget Annots in a Form and expect them to work? The spec seem unambiguous to me that it isn't valid (see PDF 32000-1:2008 pg. 431: "Fields - (Required) An array of references to the document's root fields (those with no ancestors in the field hierarchy)."). Chapter 15 of Bruno's book seems to indicate that as well, but perhaps I'm missing something. 2. What would be the best approach to deal with a form with an empty Fields array, such that the text gets flattened, assuming that this is legal? I have conveyed to the customer that I consider the file damaged and he should get better tools, but it is hard to argue against things like this where Acrobat gives no sign of anything being wrong. Thus, a third question: 3. Would it be reasonable to patch the iText code such that form flattening takes place on Annots not referenced in the Fields array of the form? Best regards, Gylfi
FormFile.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ 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/