public class AccessPermission extends Object
ProtectionPolicy
,
PDDocument.getCurrentAccessPermission()
Constructor and Description |
---|
AccessPermission()
Create a new access permission object.
|
AccessPermission(byte[] b)
Create a new access permission object from a byte array.
|
AccessPermission(int permissions)
Creates a new access permission object from a single integer.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canAssembleDocument()
This will tell if the user can insert/rotate/delete pages.
|
boolean |
canExtractContent()
This will tell if the user can extract text and images from the PDF document.
|
boolean |
canExtractForAccessibility()
This will tell if the user can extract text and images from the PDF document
for accessibility purposes.
|
boolean |
canFillInForm()
This will tell if the user can fill in interactive form fields (including signature fields)
even if
canModifyAnnotations() returns false. |
boolean |
canModify()
This will tell if the user can modify contents of the document.
|
boolean |
canModifyAnnotations()
This will tell if the user can add or modify text annotations and fill in interactive forms
fields and, if
canModify() returns true, create or modify interactive
form fields (including signature fields). |
boolean |
canPrint()
This will tell if the user can print.
|
boolean |
canPrintDegraded()
This will tell if the user can print the document in a degraded format.
|
static AccessPermission |
getOwnerAccessPermission()
returns an access permission object for a document owner.
|
int |
getPermissionBytes()
The returns an integer representing the access permissions.
|
int |
getPermissionBytesForPublicKey()
This returns an integer representing the access permissions.
|
protected boolean |
hasAnyRevision3PermissionSet()
Indicates if any revision 3 access permission is set or not.
|
boolean |
isOwnerPermission()
This will tell if the access permission corresponds to owner
access permission (no restriction).
|
boolean |
isReadOnly()
This will tell if the object has been set as read only.
|
void |
setCanAssembleDocument(boolean allowAssembly)
Set if the user can insert/rotate/delete pages.
|
void |
setCanExtractContent(boolean allowExtraction)
Set if the user can extract content from the document.
|
void |
setCanExtractForAccessibility(boolean allowExtraction)
Set if the user can extract content from the document for accessibility purposes.
|
void |
setCanFillInForm(boolean allowFillingInForm)
Set if the user can fill in interactive form fields (including signature fields) even if
canModifyAnnotations() returns false. |
void |
setCanModify(boolean allowModifications)
Set if the user can modify the document.
|
void |
setCanModifyAnnotations(boolean allowAnnotationModification)
Set if the user can add or modify text annotations and fill in interactive forms fields and,
if
canModify() returns true, create or modify interactive form fields
(including signature fields). |
void |
setCanPrint(boolean allowPrinting)
Set if the user can print.
|
void |
setCanPrintDegraded(boolean canPrintDegraded)
Set if the user can print the document in a degraded format.
|
void |
setReadOnly()
Locks the access permission read only (ie, the setters will have no effects).
|
public AccessPermission()
public AccessPermission(byte[] b)
b
- the bytes as defined in PDF specspublic AccessPermission(int permissions)
permissions
- The permission bits.public boolean isOwnerPermission()
public static AccessPermission getOwnerAccessPermission()
public int getPermissionBytesForPublicKey()
public int getPermissionBytes()
public boolean canPrint()
public void setCanPrint(boolean allowPrinting)
This method will have no effect if the object is in read only mode.
allowPrinting
- A boolean determining if the user can print.public boolean canModify()
public void setCanModify(boolean allowModifications)
This method will have no effect if the object is in read only mode.
allowModifications
- A boolean determining if the user can modify the document.public boolean canExtractContent()
public void setCanExtractContent(boolean allowExtraction)
This method will have no effect if the object is in read only mode.
allowExtraction
- A boolean determining if the user can extract content
from the document.public boolean canModifyAnnotations()
canModify()
returns true, create or modify interactive
form fields (including signature fields). Note that if
canFillInForm()
returns true, it is still possible to fill in
interactive forms (including signature fields) even if this method here returns false.public void setCanModifyAnnotations(boolean allowAnnotationModification)
canModify()
returns true, create or modify interactive form fields
(including signature fields). Note that if canFillInForm()
returns
true, it is still possible to fill in interactive forms (including signature fields) even the
parameter here is false.
This method will have no effect if the object is in read only mode.
allowAnnotationModification
- A boolean determining the new setting.public boolean canFillInForm()
canModifyAnnotations()
returns false.public void setCanFillInForm(boolean allowFillingInForm)
canModifyAnnotations()
returns false. Therefore, if you want
to prevent a user from filling in interactive form fields, you need to call
setCanModifyAnnotations(false)
as well.
This method will have no effect if the object is in read only mode.
allowFillingInForm
- A boolean determining if the user can fill in interactive forms.public boolean canExtractForAccessibility()
public void setCanExtractForAccessibility(boolean allowExtraction)
This method will have no effect if the object is in read only mode.
allowExtraction
- A boolean determining if the user can extract content
from the document.public boolean canAssembleDocument()
public void setCanAssembleDocument(boolean allowAssembly)
This method will have no effect if the object is in read only mode.
allowAssembly
- A boolean determining if the user can assemble the document.public boolean canPrintDegraded()
public void setCanPrintDegraded(boolean canPrintDegraded)
This method will have no effect if the object is in read only mode.
canPrintDegraded
- A boolean determining if the user can print the
document in a degraded format.public void setReadOnly()
public boolean isReadOnly()
protected boolean hasAnyRevision3PermissionSet()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.