public class PasswordPermissions extends Object implements IPDFPermissions
Modifier and Type | Field and Description |
---|---|
static int |
ENCRYPTION_AES_128
AES Encryption - 128 bits
|
static int |
ENCRYPTION_AES_256
AES Encryption 256 bits.
|
static int |
ENCRYPTION_RC4_128
RC4 Encryption - 128 bits
|
static int |
ENCRYPTION_RC4_40
RC4 Encryption - 40 bits
|
Constructor and Description |
---|
PasswordPermissions()
Creates a new PasswordPermissions object with all permissions granted.
|
PasswordPermissions(boolean allperms)
Creates a new PasswordPermissions object with all permissions set to allperms.
|
PasswordPermissions(int perms,
boolean ownerPasswordEntered)
Creates a new PasswordPermissions object using perms, the permissions integer representing the 12 permissions bits as specified in the PDF documentation.
|
Modifier and Type | Method and Description |
---|---|
int |
getPermFlag()
Returns the permissions int representing the 12 permissions bits as specified in the PDF documentation.
|
boolean |
hasAllPermissions()
Returns true if all permissions are granted for the document.
|
boolean |
isAssembleDocumentAllowed()
Returns the permission to assemble the document:
- insert, rotate or delete pages - create bookmarks - create thumbnail images This permission is automatically granted if the permission to change the document is granted (see isChangeDocumentAllowed() ). |
boolean |
isChangeDocumentAllowed()
Returns the permission to change the document.
|
boolean |
isExtractTextGraphicsAllowed()
Returns the permission to extract text and graphics.
|
boolean |
isExtractTextGraphicsForAccessibilityAllowed()
Returns the permission to extract text and graphics in support of accessibility to disabled users or other purposes.
|
boolean |
isFillFormFieldsAllowed()
Returns the permission to fill form fields and sign the document.
|
boolean |
isModifyAnnotsAllowed()
Returns the permission to add or modify text annotations in the document.
|
boolean |
isPrintAllowed()
Returns the permission to print the document.
|
boolean |
isPrintHighResAllowed()
Returns the permission to print the document at high resolution.
|
boolean |
ownerPasswordEntered()
Return a flag indicating whether the document was opened using the owner password if the document is encrypted.
|
void |
setAssembleDocumentAllowed(boolean allowed)
Sets the permission to assemble the document.
|
void |
setChangeDocumentAllowed(boolean allowed)
Sets the permission to change the document.
|
void |
setExtractTextGraphicsAllowed(boolean allowed)
Sets the permission to extract text and graphics.
|
void |
setExtractTextGraphicsForAccessibilityAllowed(boolean allowed)
Sets the permission to extract text and graphics in support of accessibility to disabled users or other purposes.
|
void |
setFillFormFieldsAllowed(boolean allowed)
Sets the permission to fill form fields and sign the document.
|
void |
setModifyAnnotsAllowed(boolean allowed)
Sets the permission to add or modify annotations in the document.
|
void |
setPermFlag(int perms)
Sets the permissions from the int representing the 12 permissions bits as specified in the PDF documentation.
|
void |
setPrintAllowed(boolean allowed)
Sets the permission to print the document.
|
void |
setPrintHighResAllowed(boolean allowed)
Sets the permission to print the document at high resolution.
|
public static final int ENCRYPTION_RC4_128
public static final int ENCRYPTION_AES_128
public static final int ENCRYPTION_RC4_40
public static final int ENCRYPTION_AES_256
public PasswordPermissions()
public PasswordPermissions(boolean allperms)
allperms
- flag for all permissionspublic PasswordPermissions(int perms, boolean ownerPasswordEntered)
perms
- the permissions integer representing the 12 permissions bits as specified in the PDF documentation.ownerPasswordEntered
- flag indicating wether the owner password was entered when opening the documentpublic int getPermFlag()
public boolean hasAllPermissions()
public boolean isAssembleDocumentAllowed()
isChangeDocumentAllowed()
).isAssembleDocumentAllowed
in interface IPDFPermissions
public boolean isChangeDocumentAllowed()
isAssembleDocumentAllowed()
)isModifyAnnotsAllowed()
)isFillFormFieldsAllowed()
)isChangeDocumentAllowed
in interface IPDFPermissions
public boolean isExtractTextGraphicsAllowed()
isExtractTextGraphicsForAccessibilityAllowed()
).
When this permission is not granted, the permission to extract for accessibility can be set independently.isExtractTextGraphicsAllowed
in interface IPDFPermissions
public boolean isExtractTextGraphicsForAccessibilityAllowed()
isExtractTextGraphicsAllowed()
).isExtractTextGraphicsForAccessibilityAllowed
in interface IPDFPermissions
public boolean isFillFormFieldsAllowed()
isModifyAnnotsAllowed()
)
or if the permission to change the document is granted (see isChangeDocumentAllowed()
).
When this permission is granted and the permission to change document is also granted, create or modify interactive form fields (including signature fields) is allowed.");isFillFormFieldsAllowed
in interface IPDFPermissions
public boolean isModifyAnnotsAllowed()
isFillFormFieldsAllowed()
).
When this permission is not granted, then the permission to fill form fields can be granted independently.
When this permission is granted and the permission to change document is also granted (see isChangeDocumentAllowed()
), create or modify interactive form fields (including signature fields) is allowed.");
This permission is automatically granted if the permission to change the document is granted (see isChangeDocumentAllowed()
).isModifyAnnotsAllowed
in interface IPDFPermissions
public boolean isPrintAllowed()
isPrintHighResAllowed()
)isPrintAllowed
in interface IPDFPermissions
public boolean isPrintHighResAllowed()
isPrintAllowed()
).
When this permission is not granted, then the permission to print the document can be granted independently.isPrintHighResAllowed
in interface IPDFPermissions
public boolean ownerPasswordEntered()
public void setAssembleDocumentAllowed(boolean allowed)
allowed
- the permission to assemble the document.setChangeDocumentAllowed(boolean)
public void setChangeDocumentAllowed(boolean allowed)
setAssembleDocumentAllowed(boolean)
)setModifyAnnotsAllowed(boolean)
)setFillFormFieldsAllowed(boolean)
)allowed
- the permission to change the documentpublic void setExtractTextGraphicsAllowed(boolean allowed)
isExtractTextGraphicsForAccessibilityAllowed()
).
When this permission is not granted, the permission to extract for accessibility can be set independently.allowed
- the permission to extract text and graphics.public void setExtractTextGraphicsForAccessibilityAllowed(boolean allowed)
allowed
- the permission to extract text and graphics.isExtractTextGraphicsAllowed()
public void setFillFormFieldsAllowed(boolean allowed)
allowed
- the permission to fill form fields.setChangeDocumentAllowed(boolean)
public void setModifyAnnotsAllowed(boolean allowed)
setFillFormFieldsAllowed(boolean fillFormsAllowed)
).
When this permission is not granted, then the permission to fill form fields can be granted independently.
When this permission is granted and the permission to change document is also granted (see setChangeDocumentAllowed(boolean)
), create or modify interactive form fields (including signature fields) is allowed.");allowed
- the permission to add or modify annotations.public void setPermFlag(int perms)
perms
- the permissions int.public void setPrintAllowed(boolean allowed)
allowed
- to print the document.setPrintHighResAllowed(boolean)
public void setPrintHighResAllowed(boolean allowed)
isPrintAllowed()
).
When this permission is not granted, the Print permission can be granted independently.allowed
- the permission to print at high resolution