org.icepdf.core.pobjects.security
Class Permissions

java.lang.Object
  extended by org.icepdf.core.pobjects.security.Permissions

public class Permissions
extends java.lang.Object

Standard encryption has permissions associated with it which is defined by a key in the encryption dictionary. It is up to the viewer application to respect these permissions.

The value of the P key is an unsigned 32-bit integer containing a set of flags specifying which access permissions should be granted when the document is opened with user access. The below list shows the meanings of these flags. Bit positions within the flag word are numbered from 1 (low-order) to 32 (high-order); a 1 bit in any position enables the corresponding access permission. Which bits are meaningful, and in some cases how they are interpreted, depends on the security handler's revision number (specified in the encryption dictionary's R entry).

Bits Meaning
1-2 Reserved; must be 0.
3 (Revision 2) Print the document.
(Revision 3) Print the document (possibly not at the highest quality (possibly not at the highest quality level, depending on whether bit 12 is also set).
4 Modify the contents of the document by operations other than those controlled by bits 6, 9, and 11.
5 (Revision 2) Copy or otherwise extract text and graphics from the document, including extracting text and graphics (in support of accessibility to disabled users or for other purposes). (Revision 3) Copy or otherwise extract text and graphics from the document by operations other than that controlled by bit 10.
6 Add or modify text annotations, fill in interactive form fields, and, if bit 4 is also set, create or modify interactive form fields (including signature fields).
7-8 Reserved; must be 1.
9 (Revision 3 only) Fill in existing interactive form fields (including signature fields), even if bit 6 is clear.
10 (Revision 3 only) Extract text and graphics (in support of accessibility to disabled users or for other purposes).
11 (Revision 3 only) Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if bit 4 is clear.
12 (Revision 3 only) Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this bit is clear (and bit 3 is set), printing is limited to a lowlevel representation of the appearance, possibly of degraded quality.
13-32 (Revision 3 only) Reserved; must be 1.

Note:
PDF integer objects in fact are represented internally in signed twos complement form. Since all the reserved high-order flag bits in the encryption dictionary's P value are required to be 1, the value must be specified as a negative integer. For example, assuming revision 2 of the security handler, the value -44 allows printing and copying but disallows modifying the contents and annotations.

Since:
1.1

Field Summary
static int AUTHORING_FORM_FIELDS
          Determine if authoring comments and form fields is allowed.
static int CONTENT_ACCESSABILITY
          Determine if content accessibility is allowed.
static int CONTENT_EXTRACTION
          Determine if content copying or extraction is allowed.
static int DOCUMENT_ASSEMBLY
          Determine if document assembly is allowed.
static int FORM_FIELD_FILL_SIGNING
          Determine if form field fill-in or signing is allowed.
static int MODIFY_DOCUMENT
          Determine if changing the document is allowed.
static int PRINT_DOCUMENT
          Determine if printing of document is allowed.
static int PRINT_DOCUMENT_QUALITY
          Determine the quality of printed allowed.
 
Constructor Summary
Permissions(EncryptionDictionary dictionary)
          Creates a new object which can determine a document's user permissions.
 
Method Summary
 boolean getPermissions(int permissionIndex)
          Gets the permission value of the specified Permission constant.
 void init()
          Initiate the permission object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRINT_DOCUMENT

public static final int PRINT_DOCUMENT
Determine if printing of document is allowed.

See Also:
Constant Field Values

PRINT_DOCUMENT_QUALITY

public static final int PRINT_DOCUMENT_QUALITY
Determine the quality of printed allowed.

See Also:
Constant Field Values

MODIFY_DOCUMENT

public static final int MODIFY_DOCUMENT
Determine if changing the document is allowed.

See Also:
Constant Field Values

CONTENT_EXTRACTION

public static final int CONTENT_EXTRACTION
Determine if content copying or extraction is allowed.

See Also:
Constant Field Values

AUTHORING_FORM_FIELDS

public static final int AUTHORING_FORM_FIELDS
Determine if authoring comments and form fields is allowed.

See Also:
Constant Field Values

FORM_FIELD_FILL_SIGNING

public static final int FORM_FIELD_FILL_SIGNING
Determine if form field fill-in or signing is allowed.

See Also:
Constant Field Values

CONTENT_ACCESSABILITY

public static final int CONTENT_ACCESSABILITY
Determine if content accessibility is allowed.

See Also:
Constant Field Values

DOCUMENT_ASSEMBLY

public static final int DOCUMENT_ASSEMBLY
Determine if document assembly is allowed.

See Also:
Constant Field Values
Constructor Detail

Permissions

public Permissions(EncryptionDictionary dictionary)
Creates a new object which can determine a document's user permissions.

Parameters:
dictionary - Encryption dictionary which contains a P key.
Method Detail

init

public void init()
Initiate the permission object. Extracts Permission bit values from P key.


getPermissions

public boolean getPermissions(int permissionIndex)
Gets the permission value of the specified Permission constant.

Parameters:
permissionIndex - one of the classes constants for determining a specific user permission.
Returns:
boolean value of the permission being called.