public final class StandardProtectionPolicy extends ProtectionPolicy
user_pwd
will not be
able to modify the document.
AccessPermission ap = new AccessPermission(); ap.setCanModify(false); StandardProtectionPolicy policy = new StandardProtectionPolicy(owner_pwd, user_pwd, ap); doc.protect(policy);
Constructor and Description |
---|
StandardProtectionPolicy(String ownerPassword,
String userPassword,
AccessPermission permissions)
Creates an new instance of the standard protection policy
in order to protect a PDF document with passwords.
|
Modifier and Type | Method and Description |
---|---|
String |
getOwnerPassword()
Returns the owner password.
|
AccessPermission |
getPermissions()
Returns the access permissions
|
String |
getUserPassword()
Returns the user password.
|
boolean |
isPreferAES()
Tell whether AES encryption is preferred when several encryption methods are available for
the chosen key length.
|
void |
setOwnerPassword(String ownerPassword)
Sets the owner password
|
void |
setPermissions(AccessPermission permissions)
Sets the access permissions
|
void |
setPreferAES(boolean preferAES)
Set whether AES encryption is preferred when several encryption methods are available for the
chosen key length.
|
void |
setUserPassword(String userPassword)
Sets the user password.
|
getEncryptionKeyLength, setEncryptionKeyLength
public StandardProtectionPolicy(String ownerPassword, String userPassword, AccessPermission permissions)
ownerPassword
- The owner's password.userPassword
- The users's password.permissions
- The access permissions given to the user.public AccessPermission getPermissions()
public void setPermissions(AccessPermission permissions)
permissions
- the new access permissionspublic String getOwnerPassword()
public void setOwnerPassword(String ownerPassword)
ownerPassword
- the new owner passwordpublic String getUserPassword()
public void setUserPassword(String userPassword)
userPassword
- the new user passwordpublic boolean isPreferAES()
public void setPreferAES(boolean preferAES)
preferAES
- Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.