Drawing multiple texts/images in the Signature Appearance results in an invalid signature

Hello,

in our scenario, the user signs a PDF document with a digital certificate and our application draws a text/image in the document, by finding a placeholder in the PDF text and replacing the placeholder with the data in the certificate.  It was based on the code in 

https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-digitalsignature#drawing-textimage-in-the-signature-appearance

However, problems occur when there are 2 placeholders in the PDF document, i.e. the customer wants to print the visible signature on 2 pages of the document.  

When the customer reported a problem, we had the code in PdfSignRenderer1.cs that used one PdfSignature instance, changing its Location and Bounds according to the rectangle of the found placeholder. But in this approach, the first rendered text was not in the correct location and the second text was missing. I found that the problem is in the page in the PdfSignature, that changing signature's Location and Bounds is not enough (but unfortunately signature's page cannot be changed) so I created a new Pdf Signature for each fields, with the page of the placeholder ( PdfSignRenderer2.cs). This renders both texts correctly but Acrobat Reader reports the first signature as invalid because the document was modified later.

Can I avoid invalidating the first signature or implement rendering both texts using one signature?

I attach a zipfile with:

TwoPlaceholders.pdf - document to sign, with two placeholders [PODPIS] that need to be replaced with the rendered text

TwoPlaceholderSigned_InvalidSignature.pdf - signed TwoPlaceholders.pdf with one signature reported as invalid

PdfSignRenderer1.cs - source code 1

PdfSignRenderer2.cs - source code 2 (do diff please)

Thank you very much

Regards

Jan 

https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-digitalsignature#drawing-textimage-in-the-signature-appearance


Attachment: Syncfusion_4b43215d.7z

5 Replies

IJ Irfana Jaffer Sadhik Syncfusion Team November 21, 2024 01:39 PM UTC

Hi Jan,


After further analysis of the provided code snippet, it has been found that when adding multiple signatures to the PDF document, the existing document must be saved and reloaded before adding a second signature. This step ensures the validity of the signatures. Attached for your reference is the relevant documentation. Please modify the sample accordingly and verify the results.

How to apply one or more signatures in the PDF document? | Syncfusion


If you are still facing an issue, we request you to share the modified sample with us. So that we can assist with you further in this.


Regards,

Irfana J.





JZ Jan Zahradnik November 25, 2024 02:50 PM UTC

Hello, 

I tried your suggestion and it either does not work or I do something wrong. Even when I reload the document, Adobe Acrobat reports that the first signature as invalid.

I isolated my code in a runneble sample, please check it out what's wrong.

Thank you very much.

Regards

Jan


Attachment: PDFSign_6d8c0cb6.zip


IJ Irfana Jaffer Sadhik Syncfusion Team November 26, 2024 01:32 PM UTC

Hi Jan,


We have reviewed the code snippet, you have initialized the page graphics and it has modified the document content and it invalidates the signature. 


Please comment the following line in your sample to resolve the issue,


Please try this on your end and let us know the result.


Regards,

Irfana J.




JZ Jan Zahradnik November 26, 2024 02:07 PM UTC

Dear Irfana,

it's working, you're fantastic :)

Thank you very much.

Regards

Jan



IJ Irfana Jaffer Sadhik Syncfusion Team November 27, 2024 08:24 AM UTC

Hi Jan,


We are glad to know your issue has been resolved. We are marking this incident as solved. Please feel free to create new ticket if you face any new issue.


Regards,

Irfana J,


Loader.
Up arrow icon