PDF 파일에서 첨부 파일 추출

Contents
[ ]

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");
        }
    }
}