PdfSaveOptionsDigitalSignatureDetails Property

Gets or sets the details for signing the output PDF document.

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0


public PdfDigitalSignatureDetails DigitalSignatureDetails { get; set; }

Property Value

Type: PdfDigitalSignatureDetails


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

The default value is null and the output document will not be signed. When this property is set to a valid PdfDigitalSignatureDetails object, then the output PDF document will be digitally signed.


Shows how to sign a generated PDF using Aspose.Words.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Signed PDF contents.");

// Load the certificate from disk
// The other constructor overloads can be used to load certificates from different locations
CertificateHolder certificateHolder = CertificateHolder.Create(MyDir + "morzal.pfx", "aw");

// Pass the certificate and details to the save options class to sign with
PdfSaveOptions options = new PdfSaveOptions();
DateTime signingTime = DateTime.Now;
options.DigitalSignatureDetails = new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", signingTime);

// We can use this attribute to set a different hash algorithm
options.DigitalSignatureDetails.HashAlgorithm = PdfDigitalSignatureHashAlgorithm.Sha256;

Assert.AreEqual("Test Signing", options.DigitalSignatureDetails.Reason);
Assert.AreEqual("Aspose Office", options.DigitalSignatureDetails.Location);
Assert.AreEqual(signingTime.ToUniversalTime(), options.DigitalSignatureDetails.SignatureDate);

doc.Save(ArtifactsDir + "PdfSaveOptions.PdfDigitalSignature.pdf", options);

See Also