Hi Michael, To give you more details. Check bellow on some comments on a similar old post. I will put some code in here when I can and if know one finds the solution to my problem. The strange thing is that no binary corruption occurs on signature if image is added to a new page, but it occurs if i add it to the same first and only page. This doesn't seems very justifiable I guess.
Re: [iText-questions] Signature gets corrupted when editing after sign mkl Thu, 16 Apr 2009 01:56:11 -0700 Hi, after signing a document only a very few changes to it are allowed. Additionally you must make sure you change the document in append mode. If you work in append mode and think your changes are allowed, please do throw in some code and a sample pdf. Regards, Michael. ________________________________ 2009/4/16 rui fernandes <rjmfernan...@gmail.com> > > So, It's me again, I was passing through old related topics on the mailing > list and saw a very similar problem. (Look bellow.) My problem with Paulo > Soares answer is that it's not exactly right. > Since just as I said, if I add the image to a new page the signature info > just says the document has been changed since it was originally signed. This > is ok and right. > But if I add the image the same way but in the same original first page the > signature info says the signature is corrupted and has problems with bytes > and so. This is not ok and not right. > I really think it should work the same way as when I add it to a new page. > Does anyone knows this problem? > Thanks again. > > Message: 6 > Date: Fri, 7 Jul 2006 02:39:20 -0700 (PDT) > From: mohan alagurajan <[EMAIL PROTECTED]> > Subject: [iText-questions] Watermark and Signatures > To: itext-questions@lists.sourceforge.net > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=us-ascii > > > Hi All, > > I am new to iText. I have a requirement where I have to apply watermark > to > an existing PDF, the PDF has digital signatures. > > I am using PdfStamper to apply the watermark, the code snippet is as > follows: > > PdfReader reader = new PdfReader("C:/form.pdf"); > int n = reader.getNumberOfPages(); > FileOutputStream stampOutput = new FileOutputStream("C:/stamp.pdf"); > PdfStamper stamper = new PdfStamper(reader, stampOutput); > PdfContentByte under; > PdfContentByte over; > BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, > BaseFont.EMBEDDED); > > int i = 0; > while (i < n) { > over = stamper.getOverContent(i); > over.beginText(); > over.setFontAndSize(bf, 8); > over.setTextMatrix(30, 30); > over.showText("Watermark Text"); > over.setFontAndSize(bf, 8); > over.endText(); > } > stamper.close(); > > The watermark works fine, but I face issue with the signatures, the > digital > signature becomes invalid. When I try to view the signature in the > output > PDF I get the following error: > > Error during signature verification. > > Unexpected byte range values defining scope of signed data. > Details: byte range of signature is invalid > > I also noticed that the ouput file(87 KB) is smaller in size than the > input > file(103 KB). > > Can anyone point out why the signature becomes invalid, what is wrong > with > the code and what is the right approach? > > And also why the size of the output file decreases? > > You help is very much appreciated! > > Thanks in advance! > > Regards, > Mohan Alagurajan > -- > View this message in context: > http://www.nabble.com/Watermark-and-Signatures-tf1905401.html#a5214379 > Sent from the iText - General forum at Nabble.com. > > > > > ------------------------------ > > Message: 7 > Date: Fri, 7 Jul 2006 10:42:37 +0100 > From: "Paulo Soares" <[EMAIL PROTECTED]> > Subject: Re: [iText-questions] Watermark and Signatures > To: "Post all your questions about iText here" > <itext-questions@lists.sourceforge.net> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; format=flowed; charset="iso-8859-1"; > reply-type=original > > The signature is there to show that the document was not changed. If you > > change the document the signature becomes invalid. It's not rocket > science. > > Paulo > > 2009/4/16 rui fernandes <rjmfernan...@gmail.com> >> >> Hi, >> >> When I add an image to an already signed document, the final document gets >> the old signature info corrupted. If I add the image to a new page on the >> same document the problem doesn't happen. Both image adding and signing are >> made with itext. >> >> Does anyone knows this problem already or should I start to throw some code >> in this quetsion thread? >> >> -- >> Thanks, >> Rui >> > > > > -- > Un saludo, > Rui > -- Un saludo, Rui ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ 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