Get signable content from and add the signed content to a PDF #178
-
Hello PDFsharp team! For this API I need to pass the digest of the PDF file content, SHA256 of the Base64-encoded content. Here comes the first question. How do I obtain this content through PDFsharp? The API will return the signed content in Base64 format (+timestamp, + encodedX509 and fingerprint256 from certificate) . Second question: How do I add the signature fields to the original PDF using the PDFsharp library methods? I have consulted all the information, examples, issues, including the source code, but I have not found an answer for my case. Can PDFsharp 1.5 or 6.2.0 Preview 1 provide these functionalities? Do you have an example code to share? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 8 replies
-
Look at the signature samples: Implement your own instance of the IDigitalSigner interface and make it work with your cloud-based API. |
Beta Was this translation helpful? Give feedback.
-
This is Awesome!! How to get multiple sign on same and multiple pages? Should I run this code in loop?
|
Beta Was this translation helpful? Give feedback.
-
Multiple signatures are not yet supported. This requires incremental updates - you can try the code from the PR, but this is not yet part of PDFsharp. |
Beta Was this translation helpful? Give feedback.
-
The signature verifies that the PDF was not tampered with. Any change to the PDF after signing it invalidates the signature. |
Beta Was this translation helpful? Give feedback.
-
Are you sure you used the correct owner password? It's better to combine as many steps as possible for each "Save" call. Ideally you only have to call "Save" once. Option 1: Open the document, add the security settings, add the signature, save it. Option 2: If owner password was already set, open PDF with owner password, add the signature, save it. |
Beta Was this translation helpful? Give feedback.
Look at the signature samples:
https://github.com/empira/PDFsharp.Samples/tree/master/src/samples/src/PDFsharp/src/Pdf.Signatures
Implement your own instance of the IDigitalSigner interface and make it work with your cloud-based API.