Click or drag to resize

PdfDocumentSetPasswordProtection Method

Protect document with a password.

Namespace: Patagames.Pdf.Net
Assembly: Patagames.Pdf (in Patagames.Pdf.dll) Version: 4.89.2704
public void SetPasswordProtection(
	string openPassword,
	string permissionsPassword = null,
	PdfUserAccessPermission permissions = PdfUserAccessPermission.PermitAll,
	bool encryptMetadata = true,
	EncriptionAlgorithm algorithm = EncriptionAlgorithm.AES128


openPassword  String
Set if require a password to open the document.
permissionsPassword  String  (Optional)
Set if require a password to change document restriction settings.
permissions  PdfUserAccessPermission  (Optional)
The permission flags.
encryptMetadata  Boolean  (Optional)
Indicates whether the document-level metadata stream is to be encrypted.
algorithm  EncriptionAlgorithm  (Optional)
Defines data transformations that cannot be easily reversed by unauthorized users.

You can add a password to a PDF document to limit access and restrict certain features, such as printing, copying and editing.

There are two kinds of passwords that could be applied to a PDF file: a Document Open password and a Permissions password. When you set a Document Open password, anyone who tries to open the PDF file must type in the password that you specified. When you set a Permissions password, anyone who wants to change the restrictions must type the Permissions password. Please note that if a PDF is secured with both types of passwords, it can be opened with either password, but only the Permissions password allows you to change the restrictions.

Security settings will not be applied to the document until you save the document. You will be able to continue change security settings until you close the document.

Note  Note
RC4 is a copyrighted, proprietary algorithm of RSA Security, Inc. Independent software vendors may be required to license RC4 to develop software that encrypts or decrypts PDF documents.
See Also