Dear IText Experts,
How can I appen an existing PDF with some kind of content (e.g Image) in a
way sush that the new content has incremented generation number and the
signature of the original contents (with the previous generation number)
stays valid?
What I would like:
Createing a PDF document with some kind of content.
Signing it with my "tool" and send the document to an other person.
iterate
{
The receiver person opens the PDF, modifies it (adding tables, images or
comments) and signes the PDF doc with the "tool".
The doc is forwarded to the next person.
}
At the end of the process the PDF contains all of the versions and
signetures belongs to the actual version created before.
What I used:
To extend the pdf:
PdfReader readerToModify = new PdfReader(this.inputPDF);
PdfStamper stamperToModify = new PdfStamper(readerToModify, new
FileStream(this.outputPDF, FileMode.Create, FileAccess.Write), '\0',true);
PdfContentByte under = stamperToModify.GetUnderContent(1);
Image img = Image.GetInstance(File.ReadAllBytes("hegy.jpg"));
img.SetAbsolutePosition(20f, 20f);
under.AddImage(img);
stamperToModify.Close();
For multiple signature:
PdfReader reader = new PdfReader(this.inputPDF);
PdfStamper st = PdfStamper.CreateSignature(reader, new
FileStream(this.outputPDF, FileMode.Create, FileAccess.Write), '\0', null,
true);
st.MoreInfo = this.metadata.getMetaData();
PdfSignatureAppearance sap = st.SignatureAppearance;
sap.SetCrypto(myCert.Akp, myCert.Chain, null,
PdfSignatureAppearance.WINCER_SIGNED);
sap.SetVisibleSignature(new iTextSharp.text.Rectangle(300, 650, 450, 750),
1, null);
st.Close();
The problem is that, the generation number of the image stays '0', so the
first signature will be invalid.
Please see the attached pdf files! ( 17 0 obj <</...)
OneParagraph1 is the original signed file.
OneParagraph2 is extended with one image.
OneParagraph3 is extended with one image and one more signature.
The desired state is a PDF with 2 versions, the first has one paragraph and
a signature on the version, and second version extended with one image and
one more signature on it. (In the same file.)
What should I use?
Any help would be appreciated!
Bests,
Tamas
http://old.nabble.com/file/p26132337/OneParagraph2.pdf OneParagraph2.pdf
http://old.nabble.com/file/p26132337/OneParagraph.pdf OneParagraph.pdf
http://old.nabble.com/file/p26132337/OneParagraph1.pdf OneParagraph1.pdf
--
View this message in context:
http://old.nabble.com/Append-existing-signed-PDF-with-content-in-such-way-signature-stays-valid.-%28generation-next%29-tp26132337p26132337.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
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/