PNG JPG BMP TIFF PDF
Aspose.PDF  for .NET

Extract Attachments from PDF in .NET SDK

API for extracting attachments in PDF documents with Aspose.PDF Cloud .NET SDK

Get Started

How to extract attachments from PDF documents using C# Cloud API

For extracting attachments from PDF documents, we’ll use Aspose.PDF Cloud .NET SDK This Cloud SDK allows you to easily build cloud-based PDF creator, editor & converter apps in C#, ASP.NET, or other .NET languages for various cloud platforms. Open NuGet package manager, search for Aspose.PDF Cloud and install. You may also use the following command from the Package Manager Console.

Command


PM> Install-Package Aspose.Pdf-Cloud 

Steps to extract attachments using .NET SDK

A basic extracting attachments programmatically with Aspose.PDF Cloud .NET SDK APIs can be done with just few lines of code.

  1. Upload the PDF file to cloud storage
  2. Retrieve the attachment by index
  3. Display the attachment name

System Requirements

Aspose.PDF Cloud .NET developers can easily extract attachments from PDF documents. Developers need just a few lines of code.

  • .NET Framework 2.0 or later
  • JSON.NET

 

This sample code shows extracting attachments of PDF document using C#


    internal static void GetSingleAttachments()
    {
        var STORAGE_FILE_NAME = "sample_attachment.pdf";
        var LOCAL_FILE_NAME = @"C:\Samples\Attachments\sample_attachment.pdf";
        PdfApi.UploadFile(STORAGE_FILE_NAME, File.OpenRead(LOCAL_FILE_NAME));
        var attachmentsResponse = PdfApi.GetDocumentAttachmentByIndex(STORAGE_FILE_NAME,1);        
        Console.WriteLine(attachmentsResponse.Attachment.Name);
    }