This example demonstrates how to sign an exported PDF document.
File: CustomPdfSignatureOptionsProviderAsync.cs
To pass a collection of signatures to the Web Document Viewer, implement the IPdfSignatureOptionsProviderAsync interface.
In this example, the CustomPdfSignatureOptionsProviderAsync
class implements the IPdfSignatureOptionsProviderAsync interface. The GetAvailableOptionsAsync method returns the dictionary of signature identifiers and PdfSignatureOptions objects. This dictionary defines signatures available in the Web Document Viewer.
Select a signature to sign the exported document from the Signature drop down list in the PDF Export Options section:
The selected signature is used to digitally sign the exported PDF document. The XRPdfSignature control adds a visual signature:
File: CustomViewerOperationLogger.cs
The example uses the PDF Document API to add a digital signature to a PDF document. Override the CustomizeExportDocumentOnFinish method to retrieve and modify the exported document.
Note: If you use this method to sign a PDF document, the XRPdfSignature control doesn't add a visual signature representation. To confirm that the document is signed, open it in the PDF editor.
The CustomViewerOperationLogger
service inherits the WebDocumentViewerOperationLogger class. The CustomizeExportDocumentOnFinish method creates a PKCS#7 signature with a certificate and a password specified in the object constructor. PdfSignatureBuilder properties allow you to specify the signer’s name, location, contact information, and the reason for signing.
To sign the exported document, call the PdfDocumentSigner.SaveDocument method and pass the created PdfSignatureBuilder object as a parameter.
- Print and Export Reports in ASP.NET Core Applications
- Export to PDF (Reporting)
- Sign PDF Documents (PDF Document API)
- PDF Document API - Apply Multiple Signatures
- PDF Document API - Add a Visual Signature to a PDF Document
(you will be redirected to DevExpress.com to submit your response)