HTML JPG PDF XML DOCX
  Product Family
PDF

Update Metadata in PDF in .NET SDK

Update all of the metadata from the PDF document using Aspose.PDF Cloud .NET API

Get Started

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

In order to update a 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 update Metadata via .NET SDK

Aspose.PDF Cloud developers can easily load & update 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. Update properties using PutSetProperty
  5. Handle properties, for example, print to console
 

This sample code shows updating the Metadata in PDF documents


    public static void UpdateMetadata()
    {
        const string localImageFileName = @"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);

        using var file = File.OpenRead(localImageFileName);
        var uploadResult = pdfApi.UploadFile(storageFileName, file);
        Console.WriteLine(uploadResult.Uploaded[0]);
        var response = pdfApi.GetDocumentProperty(storageFileName, "xmp:ArchiveType");
        if (response.DocumentProperty.Value != null && !response.DocumentProperty.Value.StartsWith("Aspose"))
        {
            var responseSet = pdfApi.PutSetProperty(storageFileName, "xmp:ArchiveType", "Aspose Sample Document");
            Console.WriteLine(responseSet.Status);
        }
    }