Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
在 Aspose.Pdf.Facades 命名空间 的提取功能下,附件提取是主要类别之一。该类别提供了一组方法,不仅帮助提取附件,还提供可以获取附件相关信息的方法,即 GetAttachmentInfo 和 GetAttachName 方法分别提供附件信息和附件名称。为了提取并获取附件,我们使用 ExtractAttachment 和 GetAttachment 方法。
以下代码片段向您展示如何使用 PdfExtractor 方法:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ExtractAttachments()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Attachments();
// Create the extractor
using (var pdfExtractor = new Aspose.Pdf.Facades.PdfExtractor())
{
// Bind PDF document
pdfExtractor.BindPdf(dataDir + "GetAlltheAttachments.pdf");
// Extract attachments
pdfExtractor.ExtractAttachment();
// Get attachment names
if (pdfExtractor.GetAttachNames().Count > 0)
{
Console.WriteLine("Extracting and storing...");
// Get extracted attachments
pdfExtractor.GetAttachment(dataDir + "GetAlltheAttachments_out.pdf");
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.