TrySetPrivilege
PdfFileSecurity.TrySetPrivilege method
使用原始密码设置 Pdf 文件安全性。 如果处理失败,则不抛出异常。
public bool TrySetPrivilege(string userPassword, string ownerPassword, DocumentPrivilege privilege)
范围 | 类型 | 描述 |
---|---|---|
userPassword | String | 原始用户密码。 |
ownerPassword | String | 原始所有者密码。 |
privilege | DocumentPrivilege | 设置权限。 |
返回值
真为成功,或为假。
例子
[C#]
string inFile = "D:\\input.pdf"; //TestPath 可能会被重新分配。
string outFile = "D:\\output.pdf"; //TestPath 可能会被重新分配。
PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile,outFile);
bool result = fileSecurity.TrySetPrivilege(userPassword, ownerPassword, DocumentPrivilege.Print);
[Visual Basic]
Dim inFile As String = "D:\\input.pdf" 'The TestPath may be re-assigned.'
Dim outFile As String = "D:\\output.pdf" 'The TestPath may be re-assigned.'
Dim fileSecurity As PdfFileSecurity = New PdfFileSecurity(inFile,outFile)
Dim result As Boolean = fileSecurity.TrySetPrivilege(userPassword, ownerPassword, DocumentPrivilege.Print)
也可以看看
- class DocumentPrivilege
- class PdfFileSecurity
- 命名空间 Aspose.Pdf.Facades
- 部件 Aspose.PDF