How to get PDF Metadata in C# .NET Framework
Having the capacity for retrieving metadata can greatly expand your options when it comes to organizing and cataloging your files. To get this done fast, we will be showing you a very simple method for setting this up and getting the functionality you need into your project. In total, we just need a few minutes of your time.
Let’s begin with importing our NuGet package for the library that we need:
Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.2.8
Now we can go ahead and call this function right here:
using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;namespace Example{public class EditPdfGetMetadataExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new EditPdfApi();var inputFile = new System.IO.Stream(); // System.IO.Stream | Input file to perform the operation on.try{// Get PDF document metadataPdfMetadata result = apiInstance.EditPdfGetMetadata(inputFile);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling EditPdfApi.EditPdfGetMetadata: " + e.Message );}}}}
And that, ladies and gentlemen, is the easiest way to get PDF metadata!
