To Encrypt the PDF document with open password and permission password,and set the encryption key size and permissions. Note:If set empty string value to open password or permission password, it indicates that the PDF document can be operated without providing corresponding password.

Namespace: Spire.Pdf.Security
Assembly: Spire.Pdf (in Spire.Pdf.dll) Version: 6.2.6.0 (6.2.6.2020)

Syntax

            
 C#  Visual Basic  Visual C++  F# 
public void Encrypt(
	string openPassword,
	string permissionPassword,
	PdfPermissionsFlags permissions,
	PdfEncryptionKeySize keySize,
	string originalPermissionPassword
)
Public Sub Encrypt ( 
	openPassword As String,
	permissionPassword As String,
	permissions As PdfPermissionsFlags,
	keySize As PdfEncryptionKeySize,
	originalPermissionPassword As String
)
public:
void Encrypt(
	String^ openPassword, 
	String^ permissionPassword, 
	PdfPermissionsFlags permissions, 
	PdfEncryptionKeySize keySize, 
	String^ originalPermissionPassword
)
member Encrypt : 
        openPassword : string * 
        permissionPassword : string * 
        permissions : PdfPermissionsFlags * 
        keySize : PdfEncryptionKeySize * 
        originalPermissionPassword : string -> unit 

Parameters

openPassword
String
The open password
permissionPassword
String
The permission password
permissions
PdfPermissionsFlags
A set of flags specifying which operations are permitted when the document is opened with user access
keySize
PdfEncryptionKeySize
The bit length of the encryption key
originalPermissionPassword
String

See Also