Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
パスワードまたは証明書で暗号化されたPDFドキュメントは、他の操作を実行する前に解除する必要があります。暗号化されたPDFドキュメントに対して操作を試みると、例外がスローされます。暗号化されたPDFを解除した後は、1つ以上の操作を実行できます。
PDFファイルを復号化するには、PdfFileSecurityオブジェクトを作成し、次にDecryptFileメソッドを呼び出す必要があります。また、DecryptFileメソッドにオーナーパスワードを渡す必要があります。以下のコードスニペットは、PDFファイルを復号化する方法を示しています。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void DecryptPDFFile()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_SecuritySignatures();
using (var pdfFileInfo = new Aspose.Pdf.Facades.PdfFileInfo(dataDir + "sample_encrypted.pdf"))
{
if (pdfFileInfo.IsEncrypted)
{
using (var fileSecurity = new Aspose.Pdf.Facades.PdfFileSecurity())
{
// Bind PDF document
fileSecurity.BindPdf(dataDir + "sample_encrypted.pdf");
// Decrypt PDF document
fileSecurity.DecryptFile("P@ssw0rd");
// Save PDF document
fileSecurity.Save(dataDir + "SampleDecrtypted_out.pdf");
}
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.