Could you provide an example with a signature and some other field[s]? All the attached PDFs contain AcroForm dictionaries... weird. I suppose GS/Distiller could be building an erroneous AcroForm dictionary, one that was missing fields.
That doesn't explain why iText magically functions properly after adding a dummy field. I don't think it looks through the PDF for fields when you add one... even the first one. I admit my code base is getting behind the times however (I'm still working with a pre-1.4.0, "paulo155"). --Mark Storer Senior Software Engineer Cardiff.com #include <disclaimer> typedef std::Disclaimer<Cardiff> DisCard; > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > Robert Esterer > Sent: Tuesday, November 07, 2006 10:12 AM > To: 'Post all your questions about iText here' > Subject: Re: [iText-questions] NeedAppearances & Fields > > > Thanks for the reply Paulo, but I'm not really sure if the > PDF is broken. > > For my last tests I've been using the EPS example file > provided by Adobe: > http://support.adobe.com/devsup/devsup.nsf/docs/53339.htm > And according to their pdfmark > reference(http://partners.adobe.com/public/developer/en/acroba > t/sdk/pdf/pdf_ > creation_apis_and_specs/pdfmarkReference.pdf) it seems like > the Acrobat is > not repairing the PDF but generation the display information > just like it is > supposed to be: > "NeedAppearances boolean, set to true to indicate that when > the document is > opened, traverse all widgets to generate their display and > add them to the > Fields array." > And once it did that it prompts you to save the finished PDF. > > Here is how I've been testing it: > I insert the EPS int oword and then either convert it to PS > and then PDF > using ghostscript or send it directly to the distiller from word. The > resulting PDF behaves the same in both cases. > Then I try to find any fields in the PDF using iText and come > up empty. I > tried: > .getAcroFields().getBlankSignatureNames() > .getAcroFields().getFields(); > And http://itext.ugent.be/library/question.php?id=31 > > Once I do that ugly .createEmpty(...) trick iText is able to > find and sign > them. But the resulting PDF stil lacks the display information for the > remaining empty fields. > > Also, the behaviour is the same with and without the > NeedApperances flag in > the eps. iText can't find the fields in either case unless I > use that trick! > > The flag only affect how the Acrobat displays the fields. > Even without the > flag the fields are visible and usable in the PDF, just not > listed in the > Signatures tab. > > I attached two EPS files created from a simple one page Word document > containing a single signature field. One is with > NeedApperances and one > without. And the resulting PDFs using ghostscript (gs) and > distiller(dist). > > I'm currently working my way through various pdfmarks > resources in hope of > finding a workaround for it, maybe by supplying all the > required display > information with the EPS. > > And of course I'm still open for any suggestions. > > -Robert > > PS: Outlook crashed three times while seinding this mail, so > please excuse > any duplicates. > > -----Ursprüngliche Nachricht----- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Im > Auftrag von Paulo > Soares > Gesendet: Dienstag, 7. November 2006 16:53 > An: Post all your questions about iText here > Betreff: Re: [iText-questions] NeedAppearances & Fields > > You have a broken PDF. I'm quite sure that your PDF doesn't have the > AcroForm dictionary. Acrobat manages to reconstruct it from > the page field > annotations but iText can't do it. > > Paulo > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of > > Robert Esterer > > Sent: Tuesday, November 07, 2006 3:12 PM > > To: [email protected] > > Subject: [iText-questions] NeedAppearances & Fields > > > > Hello, > > It's me again with more problems regarding NeedAppearances. > > Yesterday I thought removing it would solve my problem > (thanks to Mark > > Storer for the code and the warning about it being > > document-level) and it > > indeed makes the new signature visible but it also makes > all the empty > > fields invisble in the "Signatures" tab (Acrobat). > > I've spent some time looking at what the Acrobat does and > what iText > > does and just wanted to check if I understood it right. > > > > I have a PDF with 2+ empty signature fields. The PDF was created by > > adding eps files with pdfmarks code in an office document and > > converting them with distiller/ghostscript. The resulting > PDF contains > > empty signature fields. > > > > BUT the PDF also contains the NeedAppearances flag. This causes the > > Acrobat to ask me if I want to save the document whenever I > close it > > (even if I do nothing). Doing so causes the Acrobat to rebuild all > > signature fields. The resulting PDF looks identical to the > old one but > > a) doesn't contain the NeedApperances Flag and b) now > contains "real" > > objects (whatever that means). > > The saved document works fine with iText. > > > > BUT the unsaved (= newly created) PDF doesn't work with itext. > > One problem is that I can't seem to find any form fields > > (.getFields() and > > .getBlankSignatureNames() are epmty). > > Once I add an empty object using: > > PdfFormField field = PdfFormField.createEmpty(stp.getWriter()); > > stp.addAnnotation(field, 1); > > stp.close(); > > I can find all fields just fine. > > The other problem is that once I fill one field I have two possible > > outcomes (both of which are bad): > > a) I remove the NeedAppearance flag -> the new signature is > visible, > > all other dissapear > > B) I leave the NeedAppearance and have an "invisible" signature. > > > > So, in order to make it work with iText I have to iterate > through all > > fields and rebuild them into "real" objects before I save > sign the PDF > > for the first time!? > > For now I can probably do this by reading the old signature fields > > properties, deleting it and creating a new one with the old ones > > properties (haven't tried it yet). > > But this won't cover other types of fiels. So the million dollar > > question > > is: > > Is there a way to tell iText to rebuild the appearance for > all objects > > like the Acrobat does when you save it? > > > > Sorry for all the long text but this problem really got me > worked up > > :( > > > > Any tips would be appreciated, > > -Robert > > > > > Aviso Legal: > Esta mensagem i destinada exclusivamente ao destinatario. Pode conter > informagco confidencial ou legalmente protegida. A incorrecta > transmissco > desta mensagem nco significa a perca de confidencialidade. Se > esta mensagem > for recebida por engano, por favor envie-a de volta para o remetente e > apague-a do seu sistema de imediato. I proibido a qualquer > pessoa que nco o > destinatario de usar, revelar ou distribuir qualquer parte > desta mensagem. > > Disclaimer: > This message is destined exclusively to the intended receiver. It may > contain confidential or legally protected information. The incorrect > transmission of this message does not mean the loss of its > confidentiality. > If this message is received by mistake, please send it back > to the sender > and delete it from your system immediately. It is forbidden > to any person > who is not the intended receiver to use, distribute or copy > any part of this > message. > > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
