public class PdfPermissions
Example:
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 int | DISALLOW_ALL | |
Disallows all operations on the PDF document.
This is the default value.
|
||
static final int | ALLOW_ALL | |
Allows all operations on the PDF document.
|
||
static final int | CONTENT_COPY | |
Allows copying or otherwise extracting text and graphics from the document, including extraction for accessibility purposes.
|
||
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 |
||
static final int | MODIFY_CONTENTS | |
Allows modifying the document’s contents.
|
||
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.
|
||
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 |
||
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 |
||
static final int | PRINTING | |
Allows printing the document.
|
||
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 |
public static final int DISALLOW_ALL
public static final int ALLOW_ALL
public static final int CONTENT_COPY
public static final int CONTENT_COPY_FOR_ACCESSIBILITY
public static final int MODIFY_CONTENTS
public static final int MODIFY_ANNOTATIONS
public static final int FILL_IN
public static final int DOCUMENT_ASSEMBLY
public static final int PRINTING
public static final int HIGH_RESOLUTION_PRINTING