TryDecryptFile

PdfFileSecurity.TryDecryptFile method

通过所有者密码解密加密的 Pdf 文档。 如果文档没有所有者密码,则允许使用用户密码。 处理失败不抛出异常。

public bool TryDecryptFile(string ownerPassword)
范围类型描述
ownerPasswordString所有者密码。

返回值

真为成功,或为假。

例子

[C#]
string inFile = "D:\\input.pdf"; //TestPath 可能会被重新分配。
string outFile = "D:\\output.pdf"; //TestPath 可能会被重新分配。	
PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile,outFile);		
bool result = fileSecurity.TryDecryptFile("ownerpass");

[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.TryDecryptFile("ownerpass")

也可以看看