| 
PdfSecurity
Encrypt Method (String, String, PdfPermissionsFlags, PdfEncryptionKeySize)
  | 
 To Encrypt the PDF document 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.Doc
 Assembly:
Spire.Doc (in Spire.Doc.dll) Version: 13.2.3.0 (13.2.3.3046)
 Syntax
Syntax
 
 
public void Encrypt(
	string openPassword,
	string permissionPassword,
	PdfPermissionsFlags permissions,
	PdfEncryptionKeySize keySize
)
 
Public Sub Encrypt ( 
	openPassword As String,
	permissionPassword As String,
	permissions As PdfPermissionsFlags,
	keySize As PdfEncryptionKeySize
)
 
public:
void Encrypt(
	String^ openPassword, 
	String^ permissionPassword, 
	PdfPermissionsFlags permissions, 
	PdfEncryptionKeySize keySize
)
 
member Encrypt : 
openPassword : string * 
permissionPassword : string * 
permissions : PdfPermissionsFlags * 
keySize : PdfEncryptionKeySize -> unit 
 
 
 
Parameters
 
- 
openPassword
 
- 
 Type:
 
System
String
 
 The open password
- 
permissionPassword
 
- 
 Type:
 
System
String
 
 The permission password
- 
permissions
 
- 
 Type:
 
Spire.Doc
PdfPermissionsFlags
 
 A set of flags specifying which operations are permitted when the document is opened with user access
- 
keySize
 
- 
 Type:
 
Spire.Doc
PdfEncryptionKeySize
 
 The bit length of the encryption key
Return Value
 
 Type:
 
 
 See Also
See Also