Hi Support team!
I still have one more trouble with PdfSignature about the position of the visual signature. Here is my code to sign with certificate:
public static void signDocument(InputStream docStream, byte[] imageByte, int pageNumber, boolean isVisibleSiganature, String cerPath, String cerPassword) {
// Create PdfFileSignature instance
PdfFileSignature pdfSignSingle = new PdfFileSignature();
// Bind the source PDF by reading contents of Stream
pdfSignSingle.bindPdf(docStream);
java.awt.Rectangle rect = new java.awt.Rectangle();
rect.height = 200;
rect.width = 300;
rect.x = 0;
rect.y = 300;
Signature sig = new PKCS1(cerPath, cerPassword);
sig.setShowProperties(false);
pdfSignSingle.sign(1, isVisibleSiganature, rect, sig);
pdfSignSingle.setSignatureAppearanceStream(new ByteArrayInputStream(imageByte));
pdfSignSingle.save(“result.pdf”);
}
When i try with position (0,300,300,200) i get the correct ratio signature image, it works fine, but when i try to move the image to lower (0,100,300,200) i get the issue the image look very ugly it’s not keep the size (300x200) any more. My goal is the image will be displayed at the lower-left of pdf file and keep the size 300x200.
Currently, i am considering to replace the PDFBox which is used in my project by Aspose product, but it’s seem not easy one. Hope will get your response as soon!
Thanks