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. 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 iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions