PdfDocument.SetEncryption Method (String, String, Permission, EncryptionType)

PDF File Writer

PdfDocumentSetEncryption Method (String, String, Permission, EncryptionType)

Set encryption

Namespace:  PdfFileWriter
Assembly:  PdfFileWriter (in PdfFileWriter.dll) Version: 1.1.24.0 (1.1.24.0)
Syntax
C#
public void SetEncryption(
	string UserPassword,
	string OwnerPassword,
	Permission Permissions,
	EncryptionType EncryptionType = EncryptionType.Aes128
)

Parameters

UserPassword
Type: SystemString
User password
OwnerPassword
Type: SystemString
Owner password
Permissions
Type: PdfFileWriterPermission
Permission flags
EncryptionType (Optional)
Type: PdfFileWriterEncryptionType
Encryption type
Remarks
The PDF File Writer library will encrypt the PDF document using either AES-128 encryption or standard 128 (RC4) encryption. Encryption type is specified by the last argument. Note: the standard 128 (RC4) is considered unsafe and should not be used. User and owner passwords are as per the two arguments. A PDF reader such as Acrobat will request the user to enter a password. The user can supply either the user or the owner password. Permissions flags are set as per argument.
See Also