Class DocumentPrivilege
内容
[
隐藏
]DocumentPrivilege class
表示访问 Pdf 文件的权限。参考 PdfFileSecurity。使用此类有 4 种方式:1. 直接使用预定义权限。2. 基于预定义权限并更改一些特定权限。3. 基于预定义权限并更改一些特定的 Adobe Professional 权限组合。4. 混合方式 2 和方式 3。
public sealed class DocumentPrivilege : IComparable<object>
Properties
| Name | Description |
|---|---|
| static AllowAll { get; } | 所有允许。 |
| static Assembly { get; } | 允许组装文件。 |
| static Copy { get; } | 允许复制文件。 |
| static DegradedPrinting { get; } | 允许降级打印。 |
| static FillIn { get; } | 允许填写文件中的表单。 |
| static ForbidAll { get; } | 所有禁止。 |
| static ModifyAnnotations { get; } | 允许修改文件的注释。 |
| static ModifyContents { get; } | 允许修改文件。 |
| static Print { get; } | 允许打印文件。 |
| static ScreenReaders { get; } | 仅允许在屏幕上阅读。 |
| AllowAssembly { get; set; } | 设置允许或不允许组装的权限。 true 允许,false 禁止。 |
| AllowCopy { get; set; } | 设置允许或不允许复制的权限。 true 允许,false 禁止。 |
| AllowDegradedPrinting { get; set; } | 设置允许或不允许降级打印的权限。 true 允许,false 禁止。 |
| AllowFillIn { get; set; } | 设置允许或不允许填写表单的权限。 true 允许,false 禁止。 |
| AllowModifyAnnotations { get; set; } | 设置允许或不允许修改注释的权限。 true 允许,false 禁止。 |
| AllowModifyContents { get; set; } | 设置允许或不允许修改内容的权限。 true 允许,false 禁止。 |
| AllowPrint { get; set; } | 设置允许或不允许打印的权限。 true 允许,false 禁止。 |
| AllowScreenReaders { get; set; } | 设置允许或不允许屏幕阅读器的权限。 true 允许,false 禁止。 |
| ChangeAllowLevel { get; set; } | 获取和设置文档权限的更改级别。就像 Adobe Professional 的允许更改设置。 0: 无。 1: 插入、删除和旋转页面。 2: 填写表单字段和签署现有签名字段。 3: 注释、填写表单字段和签署现有签名字段。 4: 除提取页面外的任何操作。 |
| CopyAllowLevel { get; set; } | 获取和设置文档权限的复制级别。就像 Adobe Professional 的权限设置。 0: 无。 1: 为视力障碍者启用屏幕阅读设备的文本访问。 2: 启用文本、图像和其他内容的复制。 |
| PrintAllowLevel { get; set; } | 获取和设置文档权限的打印级别。就像 Adobe Professional 的允许打印设置。 0: 无。 1: 低分辨率 (150 dpi)。 2: 高分辨率。 |
Methods
| Name | Description |
|---|---|
| CompareTo(object) | 比较两个 DocumentPrivilege 对象。要比较的对象。一个表示此实例和值的相对值的整数。小于零时,此实例小于值。零时,此实例等于值。大于零时,此实例大于值。 |
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
- namespace Aspose.Pdf.Facades
- assembly Aspose.PDF