Click or drag to resize
Pdf Library for .NET

PdfSecurityOptions Class

Specifies the encryption and permission settings applied to the generated pdf document — user and owner passwords, encryption key size and algorithm, and per-action permissions such as printing, copying, and editing. Reached through SecurityOptions. Encryption is written only when a password is set or a permission is restricted.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalPdfSecurityOptions

Namespace: SelectPdf.Universal
Assembly: SelectPdf.HtmlToPdf.Universal (in SelectPdf.HtmlToPdf.Universal.dll) Version: 26.4
Syntax
public class PdfSecurityOptions

The PdfSecurityOptions type exposes the following members.

Constructors
 NameDescription
Public methodPdfSecurityOptions 
Top
Properties
 NameDescription
Public propertyAlgorithm Gets or sets the encryption algorithm. Defaults to AES. Setting a value that is incompatible with the current KeySize silently adjusts the key size to a supported one (AES + 40-bit → 128-bit; AES-GCM → 256-bit; RC4 + 256-bit → 128-bit).
Public propertyCanAccessibilityCopyContent Gets or sets a value indicating whether content can be copied for accessibility.
Public propertyCanAssembleDocument Gets or sets a value indicating whether the document can be assembled.
Public propertyCanCopyContent Gets or sets a value indicating whether content can be copied from the document.
Public propertyCanEditAnnotations Gets or sets a value indicating whether annotations can be edited.
Public propertyCanEditContent Gets or sets a value indicating whether the document content can be edited.
Public propertyCanFillFormFields Gets or sets a value indicating whether form fields can be filled.
Public propertyCanPrint Gets or sets a value indicating whether the document can be printed.
Public propertyEncryptMetadata Gets a value indicating whether any security setting has been changed from its default.
Public propertyKeySize Gets or sets the encryption key size. Defaults to EncryptKey256BitRevision6 (AES-256). Setting a value that is incompatible with the current Algorithm silently adjusts the algorithm to a supported one (40-bit + AES → RC4; 256-bit + RC4 → AES).
Public propertyOwnerPassword Gets or sets the owner password.
Public propertyUserPassword Gets or sets the user password.
Top
Example
HtmlToPdf converter = new HtmlToPdf();
converter.Options.SecurityOptions.UserPassword = "open123";
converter.Options.SecurityOptions.CanPrint = false;
PdfDocument doc = converter.ConvertUrl("https://www.google.com");
doc.Save("out.pdf");
doc.Close();
See Also