com.aspose.words

Class PdfPermissions

  • java.lang.Object
    • com.aspose.words.PdfPermissions
public class PdfPermissions 
extends java.lang.Object

Utility class containing constants. Specifies the operations that are allowed to a user on an encrypted PDF document.

Example:

Demonstrates how to set permissions on a PDF document generated by Aspose.Words.
Document doc = new Document(getMyDir() + "Rendering.docx");

PdfSaveOptions saveOptions = new PdfSaveOptions();

// Create encryption details and set owner password
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails("", "password", PdfEncryptionAlgorithm.RC_4_128);

// Start by disallowing all permissions
encryptionDetails.setPermissions(PdfPermissions.DISALLOW_ALL);

// Extend permissions to allow editing or modifying annotations
encryptionDetails.setPermissions(PdfPermissions.MODIFY_ANNOTATIONS | PdfPermissions.DOCUMENT_ASSEMBLY);
saveOptions.setEncryptionDetails(encryptionDetails);

// Render the document to PDF format with the specified permissions
doc.save(getArtifactsDir() + "Rendering.EncryptionPermissions.pdf", saveOptions);

Field Summary
static final intDISALLOW_ALL = 0
Disallows all operations on the PDF document. This is the default value.
static final intALLOW_ALL = 65535
Allows all operations on the PDF document.
static final intCONTENT_COPY = 16
Allows copying or otherwise extracting text and graphics from the document, including extraction for accessibility purposes.
static final intCONTENT_COPY_FOR_ACCESSIBILITY = 512
Allows extract text and graphics in support of accessibility to disabled users or for other purposes. When using RC4 40-bit encryption, this option is ignored and accessibility is allowed whenever CONTENT_COPY is set.
static final intMODIFY_CONTENTS = 8
Allows modifying the document’s contents.
static final intMODIFY_ANNOTATIONS = 32
Allows adding or modifying text annotations. When using RC4 40-bit encryption, this option also allows filling in form fields.
static final intFILL_IN = 256
Allows filling in forms and signing the document. When using RC4 40-bit encryption, this option is ignored and filling in form is allowed whenever MODIFY_ANNOTATIONS is set.
static final intDOCUMENT_ASSEMBLY = 1024
Allows assembling the document: inserting, rotating, or deleting pages and creating navigation elements such as bookmarks or thumbnail images. When using RC4 40-bit encryption, this option is ignored and document assembly is allowed when MODIFY_CONTENTS is set.
static final intPRINTING = 4
Allows printing the document.
static final intHIGH_RESOLUTION_PRINTING = 2052
Allows printing the document to the highest resolution possible. When using RC4 40-bit encryption, this option is ignored and high resolution printing is allowed when PRINTING is set.
 

    • Field Detail

      • DISALLOW_ALL = 0

        public static final int DISALLOW_ALL
        Disallows all operations on the PDF document. This is the default value.
      • ALLOW_ALL = 65535

        public static final int ALLOW_ALL
        Allows all operations on the PDF document.
      • CONTENT_COPY = 16

        public static final int CONTENT_COPY
        Allows copying or otherwise extracting text and graphics from the document, including extraction for accessibility purposes.
      • CONTENT_COPY_FOR_ACCESSIBILITY = 512

        public static final int CONTENT_COPY_FOR_ACCESSIBILITY
        Allows extract text and graphics in support of accessibility to disabled users or for other purposes. When using RC4 40-bit encryption, this option is ignored and accessibility is allowed whenever CONTENT_COPY is set.
      • MODIFY_CONTENTS = 8

        public static final int MODIFY_CONTENTS
        Allows modifying the document’s contents.
      • MODIFY_ANNOTATIONS = 32

        public static final int MODIFY_ANNOTATIONS
        Allows adding or modifying text annotations. When using RC4 40-bit encryption, this option also allows filling in form fields.
      • FILL_IN = 256

        public static final int FILL_IN
        Allows filling in forms and signing the document. When using RC4 40-bit encryption, this option is ignored and filling in form is allowed whenever MODIFY_ANNOTATIONS is set.
      • DOCUMENT_ASSEMBLY = 1024

        public static final int DOCUMENT_ASSEMBLY
        Allows assembling the document: inserting, rotating, or deleting pages and creating navigation elements such as bookmarks or thumbnail images. When using RC4 40-bit encryption, this option is ignored and document assembly is allowed when MODIFY_CONTENTS is set.
      • PRINTING = 4

        public static final int PRINTING
        Allows printing the document.
      • HIGH_RESOLUTION_PRINTING = 2052

        public static final int HIGH_RESOLUTION_PRINTING
        Allows printing the document to the highest resolution possible. When using RC4 40-bit encryption, this option is ignored and high resolution printing is allowed when PRINTING is set.