Thanks Mark.

With Acrobat blessing this behavior, I don't think I've got much choice here
- if the Fields array is empty I need to iterate through the Annotation
lists and heard up the Widget objects. I suppose it would not be fair of me
to ask that the FormFlattening code do that for me, but I'll suggest that
anyway in light of the Syntax Checker saying that the PDF is good.

Just as a side note, I'm not sure that we're doing anyone a favor with
accepting bad practices and "fixing" questionable behavior. Recently I was
asked to take a look at a PDF file that crashed some post-processing tools,
but it worked fine if it was processed by us (using iText) first. What I
found was that someone had attempted to concatenate two PDFs using 'copy/b
file1+file2 finalFile' or something like that. When you use PdfWriter to
import the pages in the resulting "PDF" file, it will work like a charm - it
is just a file with a damaged Xref - no big deal. Same thing in Acrobat -
you get a "Do you want to save your changes?" dialog when you close the
viewer, but otherwise there is no hint that the file is garbage.

Anyway, thanks again for taking the time to look at file and respond.

Best regards,

Gylfi 

-----Original Message-----
From: Mark Storer [mailto:msto...@autonomy.com] 
Sent: Thursday, November 19, 2009 3:33 PM
To: gylfi.ingva...@solimarsystems.com; Post all your questions about iText
here
Subject: Re: [iText-questions] AcroForm with empty Fields array


Acrobat 9 Pro's "PDF Syntax Check" doesn't bat an eye.  How very Odd.  That
makes your "get better tools" argument that much more difficult.



--Mark Storer
  Senior Software Engineer
  Cardiff.com

#include <disclaimer>
typedef std::Disclaimer<Cardiff> DisCard; 



> -----Original Message-----
> From: Gylfi Ingvason [mailto:gylfi.ingva...@solimarsystems.com]
> Sent: Thursday, November 19, 2009 11:47 AM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] AcroForm with empty Fields array
> 
> 
> 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
> 

----------------------------------------------------------------------------
--
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/



------------------------------------------------------------------------------
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/

Reply via email to