org.pdfbox.pdmodel.encryption
Class StandardProtectionPolicy
public class StandardProtectionPolicy
This class represents 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 password
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);
- Benoit Guillon (benoit.guillon@snv.jussieu.fr)
StandardProtectionPolicy
public StandardProtectionPolicy(String ownerPass,
String userPass,
AccessPermission perms)
Creates an new instance of the standard protection policy
in order to protect a PDF document with passwords.
ownerPass
- The owner's password.userPass
- The users's password.perms
- The access permissions given to the user.
getOwnerPassword
public String getOwnerPassword()
Getter of the property ownerPassword.
- Returns the ownerPassword.
getPermissions
public AccessPermission getPermissions()
Getter of the property permissions.
getUserPassword
public String getUserPassword()
Getter of the property userPassword.
- Returns the userPassword.
setOwnerPassword
public void setOwnerPassword(String ownerPass)
Setter of the property ownerPassword.
ownerPass
- The ownerPassword to set.
setPermissions
public void setPermissions(AccessPermission perms)
Setter of the property permissions.
perms
- The permissions to set.
setUserPassword
public void setUserPassword(String userPass)
Setter of the property userPassword.
userPass
- The userPassword to set.