Class StandardProtectionPolicy
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy
-
- org.apache.pdfbox.pdmodel.encryption.StandardProtectionPolicy
-
public class StandardProtectionPolicy extends ProtectionPolicy
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 passworduser_pwdwill 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);
- Version:
- $Revision: 1.3 $
- Author:
- Benoit Guillon (benoit.guillon@snv.jussieu.fr)
-
-
Constructor Summary
Constructors Constructor Description StandardProtectionPolicy(java.lang.String ownerPass, java.lang.String userPass, AccessPermission perms)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.StringgetOwnerPassword()Getter of the property ownerPassword.AccessPermissiongetPermissions()Getter of the property permissions.java.lang.StringgetUserPassword()Getter of the property userPassword.voidsetOwnerPassword(java.lang.String ownerPass)Setter of the property ownerPassword.voidsetPermissions(AccessPermission perms)Setter of the property permissions.voidsetUserPassword(java.lang.String userPass)Setter of the property userPassword.-
Methods inherited from class org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy
getEncryptionKeyLength, setEncryptionKeyLength
-
-
-
-
Constructor Detail
-
StandardProtectionPolicy
public StandardProtectionPolicy(java.lang.String ownerPass, java.lang.String userPass, AccessPermission perms)Creates an new instance of the standard protection policy in order to protect a PDF document with passwords.- Parameters:
ownerPass- The owner's password.userPass- The users's password.perms- The access permissions given to the user.
-
-
Method Detail
-
getPermissions
public AccessPermission getPermissions()
Getter of the property permissions.- Returns:
- Returns the permissions.
-
setPermissions
public void setPermissions(AccessPermission perms)
Setter of the property permissions.- Parameters:
perms- The permissions to set.
-
getOwnerPassword
public java.lang.String getOwnerPassword()
Getter of the property ownerPassword.- Returns:
- Returns the ownerPassword.
-
setOwnerPassword
public void setOwnerPassword(java.lang.String ownerPass)
Setter of the property ownerPassword.- Parameters:
ownerPass- The ownerPassword to set.
-
getUserPassword
public java.lang.String getUserPassword()
Getter of the property userPassword.- Returns:
- Returns the userPassword.
-
setUserPassword
public void setUserPassword(java.lang.String userPass)
Setter of the property userPassword.- Parameters:
userPass- The userPassword to set.
-
-