HTML JPG PDF XML DOCX
  Product Family
PDF

Get Metadata from PDF in .NET SDK

Build your own Cloud apps to get Fillable document files using server-side APIs.

Get Started

How to Get Metadata from PDF Document using Cloud .NET SDK

In order to get Metadata via Cloud .NET SDK , 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.

Package Manager Console Command


     
    PM> Install-Package Aspose.Pdf-Cloud
     
     

Steps to get Metadata via .NET SDK

Aspose.PDF Cloud developers can easily load & get metadata in PDF in just a few lines of code.

  1. Create a new Configuration object with your Application Secret and Key
  2. Create an object to connect to the Cloud API
  3. Upload your document file
  4. Get all properties using GetDocumentProperties
  5. Handle properties, for example, print to console
 

This sample code shows getting a Metadata from PDF documents


    public static void GetMetadata()
    {
        const string localPdfFileName = @"C:\Samples\sample.pdf";
        const string storageFileName = "sample.pdf";


        // Get your AppSid and AppSecret https://dashboard.aspose.cloud (free registration required).
        var pdfApi = new PdfApi(AppSecret, AppSid);

        if (pdfApi.GetFilesList("").Value.All(f => f.Name != "sample.pdf"))
        {
            using var file = File.OpenRead(localPdfFileName);
            var uploadResult = pdfApi.UploadFile(storageFileName, file);
            Console.WriteLine(uploadResult.Uploaded[0]);
        }

        var response = pdfApi.GetDocumentProperties(storageFileName);
        foreach (var item in response.DocumentProperties.List)
        {
            Console.WriteLine($"Name: {item.Name} Value: {item.Value}");
        }
    }