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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

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

Reply via email to