Back to Devexpress

PdfSignatureOptions Class

corelibraries-devexpress-dot-xtraprinting-1cb9f997.md

latest3.3 KB
Original Source

PdfSignatureOptions Class

Contains the settings to apply an X.509 certificate to the resulting PDF file to digitally sign the document.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public class PdfSignatureOptions :
    ICloneable
vb
Public Class PdfSignatureOptions
    Implements ICloneable

The following members return PdfSignatureOptions objects:

Remarks

The following example applies a digital signature when a report is exported to PDF.

csharp
void Export() {
    // Create a report.
    XtraReport1 report = new XtraReport1();

    // Create a new X509Certificate2 object.
    X509Certificate2 certificate = new X509Certificate2();

    // Initialize and configure a local certificate storage.
    X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
    store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);

    // Initialize a certificate collection.
    X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates;
    X509Certificate2Collection fcollection =
        (X509Certificate2Collection)collection.Find(X509FindType.FindByTimeValid, DateTime.Now, true);
    X509Certificate2Collection scollection =
        X509Certificate2UI.SelectFromCollection(fcollection, "Select a Certificate",
            "Select a certificate to view its details.",
            X509SelectionFlag.SingleSelection);
    if (scollection.Count > 0)
        certificate = scollection[0];

    // Specify PDF signature options.
    report.ExportOptions.Pdf.SignatureOptions.Reason = "Approved";
    report.ExportOptions.Pdf.SignatureOptions.Location = "USA";
    report.ExportOptions.Pdf.SignatureOptions.Certificate = certificate;
    // svgImageCollection stores SVG images.
    // In this example, it was created and populated at design time.
    report.ExportOptions.Pdf.SignatureOptions.ImageSource = new ImageSource(svgImageCollection1["approved"]);

    // Export the report to PDF.
    report.ExportToPdf("test.pdf");

    System.Diagnostics.Process.Start("test.pdf");
}

View Example: Apply a Digital Signature

See the following help topic for more information: Create a Report with a Visual PDF Signature in the Visual Studio Report Designer.

Inheritance

Object PdfSignatureOptions

See Also

PdfSignatureOptions Members

DevExpress.XtraPrinting Namespace