We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Try to remove signature information

Hi guys,


I am working with the PdfFileSignature class, i try to sign a document with a provided certificate and embed a image also. It works for me but it displayed some data that i want to remove. they are reason, date, location… i want to show only the image. How can do that?



Hi there,


Thanks for your inquiry. You may use ShowProperties property of the the Certificate object to show or hide signature properties. Please check following code snippet to hide signature properties, hopefully it will help you to accomplish the task.

PKCS7 signature = new PKCS7(pfxfile, “xxx”); // PKCS#7 or<o:p></o:p>

signature.setShowProperties(false);


Please feel free to contact us for any further assistance.

Best Regards,

thanks for the quickly response. it works for me!

Hi there,


Thanks for your feedback. It is good to know that suggested code worked for you.

Please keep using Aspose.Pdf and feel free to contact us for any further query and concern, we will more than happy to extend our support.

Best Regards,

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

Hi there,


Thanks for your inquiry. I have tested the scenario and noticed that PdfFileSignature is not retaining the given width of SignatureAppearance image, so logged a ticket PDFJAVA-36560 in our issue tracking system for further investigation and rectification.

We are sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as PDFJAVA-36560) have been fixed in Aspose.Pdf for Java 17.3.0 Release Notes.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.