Class PdfDigitalSignatureDetails

PdfDigitalSignatureDetails class

Contains details for a PDF digital signature.

public class PdfDigitalSignatureDetails

Constructors

NameDescription
PdfDigitalSignatureDetails(X509Certificate2, string, string, DateTime, PdfDigitalSignatureHashAlgorithm)Initializes a new instance of the PdfDigitalSignatureDetails class.

Properties

NameDescription
Certificate { get; set; }Gets or sets the certificate to sign with.
HashAlgorithm { get; set; }Gets or sets the hash algorithm.
Location { get; set; }Gets or sets the location of signing.
Reason { get; set; }Gets or sets the reason of signing.
SignatureDate { get; set; }Gets or sets the date of signing.

Remarks

At the moment digitally signing PDF documents is only available on .NET 2.0 or higher.

Examples

Shows how to work with PDF digital signature details.

var project = new Project(DataDir + "CreateProject2.mpp");

var options = new PdfSaveOptions();

var certificate = new X509Certificate2();

// create PDF signature details
var signatureDetails = new PdfDigitalSignatureDetails(
    // specify certificate
    certificate, 
    // specify a reason of signing
    "reason",
    // specify a location of signing
    "location", 
    // specify a date of signing
    new DateTime(2019, 1, 1), 
    // specify a hash algorithm of signing
    PdfDigitalSignatureHashAlgorithm.Sha1);

Console.WriteLine("Certificate: " + signatureDetails.Certificate);
Console.WriteLine("Reason: " + signatureDetails.Reason);
Console.WriteLine("Location: " + signatureDetails.Location);
Console.WriteLine("Signature Date: " + signatureDetails.SignatureDate);
Console.WriteLine("Hash Algorithm: " + signatureDetails.HashAlgorithm);

// set digital signature details
options.DigitalSignatureDetails = signatureDetails;

// save the project with specified encryption details
project.Save(OutDir + "WorkWithPdfEncryptionDetails_out.pdf", options);

See Also