public final class DocumentPrivilege extends Object implements Comparable
Represents the privileges for accessing Pdf file. Refer toPdfFileSecurity
.
There are 4 ways using this class:
1.Using predefined privilege directly.
2.Based on a predefined privilege and change some specifical permissions.
3.Based on a predefined privilege and change some specifical Adobe Professional permissions combination.
4.Mixes the way2 and way3.
//Way1: Using predefined privilege directly. DocumentPrivilege privilege = DocumentPrivilege.getPrint(); //Way2: Based on a predefined privilege and change some specifical permissions. DocumentPrivilege privilege = DocumentPrivilege.getAllowAll(); privilege.setAllowPrint(false); privilege.setAllowModifyContents(false); //Way3: Based on a predefined privilege and change some specifical Adobe Professional permissions combination. DocumentPrivilege privilege = DocumentPrivilege.getForbidAll(); privilege.setChangeAllowLevel(1); privilege.setPrintAllowLevel(2); //Way4: Mixes the way2 and way3 DocumentPrivilege privilege = DocumentPrivilege.getForbidAll(); privilege.setChangeAllowLevel(1); privilege.setAllowPrint(true);
Constructor and Description |
---|
DocumentPrivilege(int value) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object obj)
Compares two
DocumentPrivilege objects. |
static DocumentPrivilege |
getAllowAll()
All allowed.
|
boolean |
getAllowAssembly()
Sets the permission which allow assembly or not.
|
boolean |
getAllowCopy()
Sets the permission which allow copy or not.
|
boolean |
getAllowDegradedPrinting()
Sets the permission which allow degraded printing or not.
|
boolean |
getAllowFillIn()
Sets the permission which allow fill in forms or not.
|
boolean |
getAllowModifyAnnotations()
Sets the permission which allow modify annotations or not.
|
boolean |
getAllowModifyContents()
Sets the permission which allow modify contents or not.
|
boolean |
getAllowPrint()
Sets the permission which allow print or not.
|
boolean |
getAllowScreenReaders()
Sets the permission which allow screen readers or not.
|
static DocumentPrivilege |
getAssembly()
Allows assemblying file.
|
static DocumentPrivilege |
getCopy()
Allows copying file.
|
static DocumentPrivilege |
getDegradedPrinting()
Allows degraded printing.
|
static DocumentPrivilege |
getFillIn()
Allows filling forms in file.
|
static DocumentPrivilege |
getForbidAll()
All Forbidded.
|
static DocumentPrivilege |
getModifyAnnotations()
Allows modifying annotations of file.
|
static DocumentPrivilege |
getModifyContents()
Allows modifying file.
|
static DocumentPrivilege |
getPrint()
Allows printing file.
|
static DocumentPrivilege |
getScreenReaders()
Allows to reader on screen only.
|
int |
getValue() |
void |
setAllowAssembly(boolean value) |
void |
setAllowCopy(boolean value) |
void |
setAllowDegradedPrinting(boolean value) |
void |
setAllowFillIn(boolean value) |
void |
setAllowModifyAnnotations(boolean value) |
void |
setAllowModifyContents(boolean value) |
void |
setAllowPrint(boolean value) |
void |
setAllowScreenReaders(boolean value) |
void |
setChangeAllowLevel(int value)
Sets the change level of document's privilege.
|
void |
setCopyAllowLevel(int value)
Sets the copy level of document's privilege.
|
void |
setPrintAllowLevel(int value)
Sets the print level of document's privilege.
|
public int getValue()
public boolean getAllowPrint()
Sets the permission which allow print or not. true is allow and false is forbidden.
public void setAllowPrint(boolean value)
public boolean getAllowDegradedPrinting()
Sets the permission which allow degraded printing or not. true is allow and false is forbidden.
public void setAllowDegradedPrinting(boolean value)
public boolean getAllowModifyContents()
Sets the permission which allow modify contents or not. true is allow and false is forbidden.
public void setAllowModifyContents(boolean value)
public boolean getAllowCopy()
Sets the permission which allow copy or not. true is allow and false is forbidden.
public void setAllowCopy(boolean value)
public boolean getAllowModifyAnnotations()
Sets the permission which allow modify annotations or not. true is allow and false is forbidden.
public void setAllowModifyAnnotations(boolean value)
public boolean getAllowFillIn()
Sets the permission which allow fill in forms or not. true is allow and false is forbidden.
public void setAllowFillIn(boolean value)
public boolean getAllowScreenReaders()
Sets the permission which allow screen readers or not. true is allow and false is forbidden.
public void setAllowScreenReaders(boolean value)
public boolean getAllowAssembly()
Sets the permission which allow assembly or not. true is allow and false is forbidden.
public void setAllowAssembly(boolean value)
public void setPrintAllowLevel(int value)
Sets the print level of document's privilege. Just as the Adobe Professional's Printing Allowed settings. 0: None. 1: Low Resolution (150 dpi). 2: High Resolution.
public void setChangeAllowLevel(int value)
Sets the change level of document's privilege. Just as the Adobe Professional's Changes Allowed settings. 0: None. 1: Inserting, Deleting and Rotating pages. 2: Filling in form fields and signing existing signature fields. 3: Commenting, filling in form fields, and signing existing signature fields. 4: Any except extracting pages.
public void setCopyAllowLevel(int value)
Sets the copy level of document's privilege. Just as the Adobe Professional's permission settings. 0: None. 1: Enable text access for screen reader devices for the visually impaired. 2: Enable copying of text, images and other content.
public int compareTo(Object obj)
Compares two DocumentPrivilege
objects.
compareTo
in interface Comparable
obj
- The object to compare with.public static DocumentPrivilege getDegradedPrinting()
Allows degraded printing.
public static DocumentPrivilege getPrint()
Allows printing file.
public static DocumentPrivilege getModifyContents()
Allows modifying file.
public static DocumentPrivilege getCopy()
Allows copying file.
public static DocumentPrivilege getModifyAnnotations()
Allows modifying annotations of file.
public static DocumentPrivilege getFillIn()
Allows filling forms in file.
public static DocumentPrivilege getScreenReaders()
Allows to reader on screen only.
public static DocumentPrivilege getAssembly()
Allows assemblying file.
public static DocumentPrivilege getAllowAll()
All allowed.
public static DocumentPrivilege getForbidAll()
All Forbidded.
Copyright © 2020 Aspose. All Rights Reserved.