We have been trying to add annotation/stamp to an existing SIGNED PDF without invalidating the Signature but unfortunately browsers wont show the stamp/annotation. When opened in Adobe Reader the annotation can be seen there. Any other idea is welcome. All we want is a little text on existing signed PDF that wont invalidate the signature.
Here is our code:
PdfReader reader = new PdfReader(pdf1);
PdfStamper pdfStamper = new PdfStamper(reader, new FileOutputStream(RESULT), '\0', true);
PdfContentByte pcb = new PdfContentByte(pdfStamper.getWriter());
PdfAnnotation annot = PdfAnnotation.createFreeText(pdfStamper.getWriter(), new Rectangle(150, 150, 200, 200), "Annotation 1", pcb);
annot.setFlags(PdfAnnotation.FLAGS_PRINT);
pdfStamper.addAnnotation(annot, 1);
pdfStamper.close();