Digital Signature Information lost when adding image stamp

I am using aspose.pdf-17.2.0 for java.
I have this scenario:
I added digital signature on a pdf,
then i added image stamp on that pdf contains digital signature.
The new file that contains image stamp, should also contains digital certificate information, But all information of digital Signature is corrupted.

Waiting for reply.

Thanks

@mukhan12

Thank you for contacting support.

Documents are signed to prevent modifications so it is the expected behavior if signature becomes invalid upon changes. Therefore, you may please add the image stamp before signing the PDF document. If you still face any problem then share SSCCE code along with source and generated files. Before sharing requested data, please ensure using Aspose.PDF for Java 19.8 in your environment.

@Farhan.Raza
Dear Farhan,

Thank You for your support. Here You can see Signed Document, and then I added image in that document,and in Output-after-image-stamp.pdf Signature is corrupted, it is not showing any information about signer, It should show at least signer name in signature details, it is saying Signature contains corrupted data.

I agree with you that Signature should be Invalidate after changing, but it should not be corrupted. Information should be there.

I am using Aspose.PDF for Java 19.8
I used this code to add image Stamp:

                    String dataDir = "C:/Users/Usman/Desktop/";
	        Document pdfDocument = new Document(dataDir + "Signed-Document.pdf");
		// create image stamp
		ImageStamp imageStamp = new ImageStamp(dataDir+"Cofidential.png");
		imageStamp.setBackground(true);
		imageStamp.setXIndent(300);
		imageStamp.setYIndent(300);
		imageStamp.setHeight(147);
		imageStamp.setWidth(189);
		// add stamp to particular page
		Page page=pdfDocument.getPages().get_Item(1);
		page.addStamp(imageStamp);
		// save output document
		pdfDocument.save(dataDir+"OutPut-after-image-stamp.pdf"); 

Signed-Document.pdf (176.8 KB)
OutPut-after-image-stamp.pdf (248.4 KB)

@mukhan12

Thank you for elaborating further.

We have logged a ticket with ID PDFJAVA-38885 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

@mukhan12

We have investigated it and would like to suggest you to use pdfDocument.saveIncrementally() method instead of pdfDocument.save() method. In this case you will be able see full information about signature and will be able to get unmodified version which was signed initially.