PdfSaveOptionsEncryptionDetails Property
Gets or sets the details for encrypting the output PDF document.

Namespace: Aspose.Words.Saving
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.12
public PdfEncryptionDetails EncryptionDetails { get; set; }

Property Value

Type: PdfEncryptionDetails

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

Note that encryption cannot be used when PDF/A compliance is set as this compliance does not permit encryption.");

Demonstrates how to set permissions on a PDF document generated by Aspose.Words.
Document doc = new Document(MyDir + "Rendering.doc");

PdfSaveOptions saveOptions = new PdfSaveOptions();

// Create encryption details and set owner password.
PdfEncryptionDetails encryptionDetails =
    new PdfEncryptionDetails("password", string.Empty, PdfEncryptionAlgorithm.RC4_128);

// Start by disallowing all permissions.
encryptionDetails.Permissions = PdfPermissions.DisallowAll;

// Extend permissions to allow editing or modifying annotations.
encryptionDetails.Permissions = PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly;
saveOptions.EncryptionDetails = encryptionDetails;

// Render the document to PDF format with the specified permissions.
doc.Save(ArtifactsDir + "Rendering.SpecifyPermissions.pdf", saveOptions);
See Also