HTML JPG PDF XML DOCX
  Product Family
PDF

Add Metadata to PDF in .NET SDK

Add a Metadata to a PDF Document using server-side .NET API.

Get Started

How to create Metadata via Cloud .NET SDK

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

Aspose.PDF Cloud developers can easily load & create 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. Set desired property using PutSetProperty
  5. Download the result if needed
 

This sample code shows creating a Metadata in PDF documents


    public static void AddMetadata()
    {
        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);
        var filesOnStorage = pdfApi.GetFilesList("");
        if (filesOnStorage.Value.All(f => f.Name != "sample.pdf"))
        {
            using var file = File.OpenRead(localImageFileName);
            var uploadResult = pdfApi.UploadFile(storageFileName, file);
            Console.WriteLine(uploadResult.Uploaded[0]);
        }
        var response = pdfApi.PutSetProperty(storageFileName, "xmp:ArchiveDate", 
            DateTime.Today.ToString(CultureInfo.InvariantCulture));
        Console.WriteLine(response.Status);
    }