Property EncryptionHandler
- Namespace
- BitMiracle.Docotic.Pdf
- Assembly
- BitMiracle.Docotic.Pdf.dll
EncryptionHandler
Gets or sets the encryption handler to use while encrypting the output PDF.
public PdfEncryptionHandler? EncryptionHandler { get; set; }
Property Value
- PdfEncryptionHandler
The encryption handler to use while encrypting the output PDF.
Remarks
Default value: null
.
If this property is null
, then the library won't encrypt the output document.
There is an exception from this rule. See below for more info about incremental updates
and encryption.
Set this property to an instance of PdfStandardEncryptionHandler to protect the output document with password(s).
Set this property to an instance of PdfPublicKeyEncryptionHandler to protect the output document with certificate(s).
PDF/A documents can not be encrypted. Therefore, an exception will be thrown if you
try to use an encryption handler when ProducePdfA is true
.
When saving a file incrementally (when WriteIncrementally is true
),
it is required that all document revisions use the same encryption properties. All
revisions must either be encrypted using the same password or certificate data or none
must be encrypted. Because of this, in incremental save mode, the library ignores the
value of this property and uses whatever encryption is already present in the file.
The Encrypt PDF documents in C# and VB.NET article shows how to use this property to protect PDF files.