DocumentPrivilege

DocumentPrivilege class

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.

public sealed class DocumentPrivilege : IComparable<object>

Properties

Name Description
static AllowAll { get; } All allowed.
static Assembly { get; } Allows assemblying file.
static Copy { get; } Allows copying file.
static DegradedPrinting { get; } Allows degraded printing.
static FillIn { get; } Allows filling forms in file.
static ForbidAll { get; } All Forbidded.
static ModifyAnnotations { get; } Allows modifying annotations of file.
static ModifyContents { get; } Allows modifying file.
static Print { get; } Allows printing file.
static ScreenReaders { get; } Allows to reader on screen only.
AllowAssembly { get; set; } Sets the permission which allow assembly or not. true is allow and false is forbidden.
AllowCopy { get; set; } Sets the permission which allow copy or not. true is allow and false is forbidden.
AllowDegradedPrinting { get; set; } Sets the permission which allow degraded printing or not. true is allow and false is forbidden.
AllowFillIn { get; set; } Sets the permission which allow fill in forms or not. true is allow and false is forbidden.
AllowModifyAnnotations { get; set; } Sets the permission which allow modify annotations or not. true is allow and false is forbidden.
AllowModifyContents { get; set; } Sets the permission which allow modify contents or not. true is allow and false is forbidden.
AllowPrint { get; set; } Sets the permission which allow print or not. true is allow and false is forbidden.
AllowScreenReaders { get; set; } Sets the permission which allow screen readers or not. true is allow and false is forbidden.
ChangeAllowLevel { set; } 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.
CopyAllowLevel { set; } 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.
PrintAllowLevel { set; } 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.

Methods

Name Description
CompareTo(object) Compares two DocumentPrivilege objects. The object to compare with. A signed integer that indicates the relative values of this instance and value. Less than zero this instance is less than value. Zero this instance is equal to value. Greater than zero this instance is greater than value.

Examples

[C#]	
//Way1: Using predefined privilege directly.
DocumentPrivilege privilege = DocumentPrivilege.Print;

//Way2: Based on a predefined privilege and change some specifical permissions.
DocumentPrivilege privilege = DocumentPrivilege.AllowAll;
privilege.AllowPrint = false;
privilege.AllowModifyContents = false;

//Way3: Based on a predefined privilege and change some specifical Adobe Professional permissions combination.
DocumentPrivilege privilege = DocumentPrivilege.ForbidAll;
privilege.ChangeAllowLevel = 1;
privilege.PrintAllowLevel = 2;

//Way4: Mixes the way2 and way3
DocumentPrivilege privilege = DocumentPrivilege.ForbidAll;
privilege.ChangeAllowLevel = 1;
privilege.AllowPrint = true;

[Visual Basic]
'Way1: Using predefined privilege directly.
Dim privilege As DocumentPrivilege =  DocumentPrivilege.Print 

'Way2: Based on a predefined privilege and change some specifical permissions.
Dim privilege As DocumentPrivilege =  DocumentPrivilege.AllowAll 
privilege.AllowPrint = False
privilege.AllowModifyContents = False

'Way3: Based on a predefined privilege and change some specifical Adobe Professional permissions combination.
Dim privilege As DocumentPrivilege =  DocumentPrivilege.ForbidAll 
privilege.ChangeAllowLevel = 1
privilege.PrintAllowLevel = 2

'Way4: Mixes the way2 and way3
Dim privilege As DocumentPrivilege =  DocumentPrivilege.ForbidAll 
privilege.ChangeAllowLevel = 1
privilege.AllowPrint = True

See Also