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.
Inheritance Hierarchy
SystemObject
  Aspose.Pdf.FacadesDocumentPrivilege

Namespace: Aspose.Pdf.Facades
Assembly: Aspose.PDF (in Aspose.PDF.dll) Version: 19.10
Syntax
public sealed class DocumentPrivilege : IComparable<Object>

The DocumentPrivilege type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberAllowAll
All allowed.
Public propertyAllowAssembly
Sets the permission which allow assembly or not. true is allow and false is forbidden.
Public propertyAllowCopy
Sets the permission which allow copy or not. true is allow and false is forbidden.
Public propertyAllowDegradedPrinting
Sets the permission which allow degraded printing or not. true is allow and false is forbidden.
Public propertyAllowFillIn
Sets the permission which allow fill in forms or not. true is allow and false is forbidden.
Public propertyAllowModifyAnnotations
Sets the permission which allow modify annotations or not. true is allow and false is forbidden.
Public propertyAllowModifyContents
Sets the permission which allow modify contents or not. true is allow and false is forbidden.
Public propertyAllowPrint
Sets the permission which allow print or not. true is allow and false is forbidden.
Public propertyAllowScreenReaders
Sets the permission which allow screen readers or not. true is allow and false is forbidden.
Public propertyStatic memberAssembly
Allows assemblying file.
Public propertyChangeAllowLevel
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 propertyStatic memberCopy
Allows copying file.
Public propertyCopyAllowLevel
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 propertyStatic memberDegradedPrinting
Allows degraded printing.
Public propertyStatic memberFillIn
Allows filling forms in file.
Public propertyStatic memberForbidAll
All Forbidded.
Public propertyStatic memberModifyAnnotations
Allows modifying annotations of file.
Public propertyStatic memberModifyContents
Allows modifying file.
Public propertyStatic memberPrint
Allows printing file.
Public propertyPrintAllowLevel
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 propertyStatic memberScreenReaders
Allows to reader on screen only.
Methods
  NameDescription
Public methodCompareTo
Compares two DocumentPrivilege objects. The object to compare with.

Return Value

Type: 
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.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
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