PdfSaveOptions.EncryptionDetails

PdfSaveOptions EncryptionDetails property. Gets or sets the details for encrypting the output PDF document.

PdfSaveOptions.EncryptionDetails property

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

public PdfEncryptionDetails EncryptionDetails { get; set; }

Remarks

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.

AES-128 encryption algorithm is used when saving to PDF 1.7 based compliance (including PDF/UA-1). AES-256 encryption algorithm is used when saving to PDF 2.0 based compliance.

Encryption is prohibited by PDF/A compliance. This option will be ignored when saving to PDF/A.

ContentCopyForAccessibility permission is required by PDF/UA compliance if the output document is encrypted. This permission will automatically used when saving to PDF/UA.

ContentCopyForAccessibility permission is deprecated in PDF 2.0 format. This permission will be ignored when saving to PDF 2.0.

Examples

Shows how to specify PDF document encryption details.

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.EncryptionDetails = new PdfEncryptionDetails("userPass", "1234", PdfPermissions.Printing);

// Change permissions and password after creation of PdfEncryptionDetails object.
pdfSaveOptions.EncryptionDetails.OwnerPassword = "12345";
pdfSaveOptions.EncryptionDetails.UserPassword = "123";
pdfSaveOptions.EncryptionDetails.Permissions = PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly;

Converter.Create()
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "PdfSaveOptions.EncryptionDetails.pdf", pdfSaveOptions)
    .Execute();

See Also