I'm with a big problem trying to rotate a PdfSignatureAppearance in iText (90 degrees, for instance). I'm signing a PDF using the MakeSignature.signDetached method, and setting my own text and image for the appearance.
Here is some code:
PdfReader reader = new PdfReader("my input file");
FileOutputStream fout = new FileOutputStream("my output file");
PdfStamper stamper = PdfStamper.createSignature(reader, fout, '\0');
PdfSignatureAppearance sap = stamper.getSignatureAppearance();
sap.setLayer2Text("Signed by someone");
sap.setAcro6Layers(true);
sap.setSignatureGraphic("my signature image", null));
sap.setRenderingMode(PdfSignatureAppearance.RenderingMode.GRAPHIC_AND_DESCRIPTION);
Rectangle pageSize = reader.getPageSize(1); //the page to sign: 1 is the 1st one
Rectangle rect = new Rectangle(llx, lly, urx, ury, rotation);
//llx, lly ... come from a GUI. They are working fine, but the rotation is not considered
sap.setVisibleSignature(rect, 1, null); //1 is the page to sign
MakeSignature.signDetached(sap, ...); //sign the document
My problem is the "rotation" argument. No matter what I set, the text and the image never rotate. Looking at iText code (I'm using iText 5.3.2), the rotation argument of the bounding box of the signature layer is discarded, so, well, setting the rotation this way have no effect at all.
Now the question: Is there a way to rotate my signature layer without rewriting the entire PdfSignatureAppearance and MakeSignature classes?
Just to clarify: the code that digitally signs the document is working fine. My only problem is with the visual layer of the signature: I can't rotate it.
Thanks.