Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
PDF документ, зашифрованный паролем или сертификатом, должен быть разблокирован перед выполнением другой операции с ним. Если вы попытаетесь выполнить операцию с зашифрованным PDF документом, будет выброшено исключение. После разблокировки зашифрованного PDF вы можете выполнить одну или несколько операций с ним.
Чтобы дешифровать 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.