public class PdfPermissions
extends java.lang.Object
Examples:
Shows how to set permissions on a saved PDF document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("Hello world!");
// Extend permissions to allow the editing of annotations.
PdfEncryptionDetails encryptionDetails =
new PdfEncryptionDetails("password", "", PdfPermissions.MODIFY_ANNOTATIONS | PdfPermissions.DOCUMENT_ASSEMBLY);
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Enable encryption via the "EncryptionDetails" property.
saveOptions.setEncryptionDetails(encryptionDetails);
// When we open this document, we will need to provide the password before accessing its contents.
doc.save(getArtifactsDir() + "PdfSaveOptions.EncryptionPermissions.pdf", saveOptions);
| Modifier and Type | Field and Description |
|---|---|
static int |
ALLOW_ALL
Allows all operations on the PDF document.
|
static int |
CONTENT_COPY
Copy or otherwise extract text and graphics from the document by operations other than that controlled by
CONTENT_COPY_FOR_ACCESSIBILITY. |
static int |
CONTENT_COPY_FOR_ACCESSIBILITY
Extract text and graphics (in support of accessibility to users with disabilities or for other purposes).
|
static int |
DISALLOW_ALL
Disallows all operations on the PDF document.
|
static int |
DOCUMENT_ASSEMBLY
Assemble the document (insert, rotate, or delete pages and create document outline items or thumbnail images), even if
MODIFY_CONTENTS is clear. |
static int |
FILL_IN
Fill in existing interactive form fields (including signature fields), even if
MODIFY_CONTENTS is clear. |
static int |
HIGH_RESOLUTION_PRINTING
Print the document to a representation from which a faithful digital copy of the PDF content could be generated, based on an implementation-dependent algorithm.
|
static int |
length |
static int |
MODIFY_ANNOTATIONS
Add or modify text annotations, fill in interactive form fields, and, if
MODIFY_CONTENTS is also set, create or modify interactive form fields (including signature fields). |
static int |
MODIFY_CONTENTS
Modify the contents of the document by operations other than those controlled by
MODIFY_ANNOTATIONS, FILL_IN, and DOCUMENT_ASSEMBLY. |
static int |
PRINTING
Print the document (possibly not at the highest quality level, depending on whether
HIGH_RESOLUTION_PRINTING is also set). |
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String pdfPermissionsName) |
static int |
fromNames(java.util.Set pdfPermissionsNames) |
static java.lang.String |
getName(int pdfPermissions) |
static java.util.Set |
getNames(int pdfPermissions) |
static int[] |
getValues() |
static java.lang.String |
toString(int pdfPermissions) |
static java.lang.String |
toStringSet(int attr) |
public static int DISALLOW_ALL
public static int ALLOW_ALL
public static int CONTENT_COPY
CONTENT_COPY_FOR_ACCESSIBILITY.public static int CONTENT_COPY_FOR_ACCESSIBILITY
public static int MODIFY_CONTENTS
MODIFY_ANNOTATIONS, FILL_IN, and DOCUMENT_ASSEMBLY.public static int MODIFY_ANNOTATIONS
MODIFY_CONTENTS is also set, create or modify interactive form fields (including signature fields).public static int FILL_IN
MODIFY_CONTENTS is clear.public static int DOCUMENT_ASSEMBLY
MODIFY_CONTENTS is clear.public static int PRINTING
HIGH_RESOLUTION_PRINTING is also set).public static int HIGH_RESOLUTION_PRINTING
PRINTING is set), printing shall be limited to a low-level representation of the appearance, possibly of degraded quality.public static int length
public static java.lang.String getName(int pdfPermissions)
public static java.util.Set getNames(int pdfPermissions)
public static java.lang.String toString(int pdfPermissions)
public static java.lang.String toStringSet(int attr)
public static int fromName(java.lang.String pdfPermissionsName)
public static int fromNames(java.util.Set pdfPermissionsNames)
public static int[] getValues()