Package com.pd4ml.pdf.encryption
Class StandardProtectionPolicy
- java.lang.Object
-
- com.pd4ml.pdf.encryption.ProtectionPolicy
-
- com.pd4ml.pdf.encryption.StandardProtectionPolicy
-
public final class StandardProtectionPolicy extends ProtectionPolicy
The protection policy to add to a document for password-based protection. The following example shows how to protect a PDF document with password. In this example, the document will be protected so that someone opening the document with the user passworduser_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);
- Author:
- Benoit Guillon
-
-
Constructor Summary
Constructors Constructor Description StandardProtectionPolicy(java.lang.String ownerPassword, java.lang.String userPassword, AccessPermission permissions)
Creates an new instance of the standard protection policy in order to protect a PDF document with passwords.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getOwnerPassword()
Returns the owner password.AccessPermission
getPermissions()
Returns the access permissionsjava.lang.String
getUserPassword()
Returns the user password.void
setOwnerPassword(java.lang.String ownerPassword)
Sets the owner passwordvoid
setPermissions(AccessPermission permissions)
Sets the access permissionsvoid
setUserPassword(java.lang.String userPassword)
Sets the user password.-
Methods inherited from class com.pd4ml.pdf.encryption.ProtectionPolicy
getEncryptionKeyLength, isPreferAES, setEncryptionKeyLength, setPreferAES
-
-
-
-
Constructor Detail
-
StandardProtectionPolicy
public StandardProtectionPolicy(java.lang.String ownerPassword, java.lang.String userPassword, AccessPermission permissions)
Creates an new instance of the standard protection policy in order to protect a PDF document with passwords.- Parameters:
ownerPassword
- The owner password.userPassword
- The user password.permissions
- The access permissions given to the user.
-
-
Method Detail
-
getPermissions
public AccessPermission getPermissions()
Returns the access permissions- Returns:
- the access permissions
-
setPermissions
public void setPermissions(AccessPermission permissions)
Sets the access permissions- Parameters:
permissions
- the new access permissions
-
getOwnerPassword
public java.lang.String getOwnerPassword()
Returns the owner password.- Returns:
- the owner password
-
setOwnerPassword
public void setOwnerPassword(java.lang.String ownerPassword)
Sets the owner password- Parameters:
ownerPassword
- the new owner password
-
getUserPassword
public java.lang.String getUserPassword()
Returns the user password.- Returns:
- the user password
-
setUserPassword
public void setUserPassword(java.lang.String userPassword)
Sets the user password.- Parameters:
userPassword
- the new user password
-
-