This example illustrates how to sign a PDF document. Please note that the PdfDocumentProcessor class allows you to apply only one digital signature to a PDF document. If you need to sign the same PDF document multiple times, use the solution from this example: How to Apply Multiple Signatures.
The Universal Subscription or an additional Office File API Subscription is required to use this example in production code. Please refer to the DevExpress Subscription page for pricing information.
To accomplish this task, do the following:
• Create a PDF document processor.
• Load a PDF file from a file using the PdfDocumentProcessor.LoadDocument method.
• Create a certificate using a certificate file name and a password to access the certificate;
• Create a document visual signature using one of the PdfSignature constructor overloads that takes 4 arguments. For example, using a certificate, image data represented by a byte array, and specifying the page number and signature bounds. The signature bounds are represented by a DevExpress.Pdf.PdfOrientedRectangle object. You can specify the rotation angle for the signature (in radians) when creating a PdfOrientedRectangle object.
• Specify signing location, contact info and reason using the PdfSignature.Location, PdfSignature.ContactInfo and PdfSignature.Reason properties, correspondingly.
• Save the signed document with signing information by calling the PdfDocumentProcessor.SaveDocument method.