| PdfDocumentSetPasswordProtection Method |
Protect document with a password.
Namespace: Patagames.Pdf.NetAssembly: Patagames.Pdf (in Patagames.Pdf.dll) Version: 4.89.2704
Syntax public void SetPasswordProtection(
string openPassword,
string permissionsPassword = null,
PdfUserAccessPermission permissions = PdfUserAccessPermission.PermitAll,
bool encryptMetadata = true,
EncriptionAlgorithm algorithm = EncriptionAlgorithm.AES128
)
Public Sub SetPasswordProtection (
openPassword As String,
Optional permissionsPassword As String = Nothing,
Optional permissions As PdfUserAccessPermission = PdfUserAccessPermission.PermitAll,
Optional encryptMetadata As Boolean = true,
Optional algorithm As EncriptionAlgorithm = EncriptionAlgorithm.AES128
)
public:
void SetPasswordProtection(
String^ openPassword,
String^ permissionsPassword = nullptr,
PdfUserAccessPermission permissions = PdfUserAccessPermission::PermitAll,
bool encryptMetadata = true,
EncriptionAlgorithm algorithm = EncriptionAlgorithm::AES128
)
member SetPasswordProtection :
openPassword : string *
?permissionsPassword : string *
?permissions : PdfUserAccessPermission *
?encryptMetadata : bool *
?algorithm : EncriptionAlgorithm
(* Defaults:
let _permissionsPassword = defaultArg permissionsPassword null
let _permissions = defaultArg permissions PdfUserAccessPermission.PermitAll
let _encryptMetadata = defaultArg encryptMetadata true
let _algorithm = defaultArg algorithm EncriptionAlgorithm.AES128
*)
-> unit
public void SetPasswordProtection(
String openPassword,
String permissionsPassword = null,
PdfUserAccessPermission permissions = PdfUserAccessPermission.PermitAll,
boolean encryptMetadata = true,
EncriptionAlgorithm algorithm = EncriptionAlgorithm.AES128
)
function SetPasswordProtection(openPassword, permissionsPassword, permissions, encryptMetadata, algorithm);
Parameters
- 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.
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 |
---|
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