PdfSaveOptionsEncryptionDetails Property |
Namespace: Aspose.Words.Saving
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.");
Document doc = new Document(MyDir + "Rendering.docx"); 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.EncryptionPermissions.pdf", saveOptions);