Click or drag to resize

PdfDocumentSetPasswordProtection Method

Protect document with a password.

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

Parameters

openPassword
Type: SystemString
Set if require a password to open the document.
permissionsPassword (Optional)
Type: SystemString
Set if require a password to change document restriction settings.
permissions (Optional)
Type: Patagames.Pdf.EnumsPdfUserAccessPermission
The permission flags.
encryptMetadata (Optional)
Type: SystemBoolean
Indicates whether the document-level metadata stream is to be encrypted.
algorithm (Optional)
Type: Patagames.Pdf.EnumsEncriptionAlgorithm
Defines data transformations that cannot be easily reversed by unauthorized users.
Remarks

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