Extract PDF Metadata via C#

How to Edit PDF Metadata Using .NET Library

How to Extract PDF Metadata Using .NET

In order to Extract Metadata from PDF files, we’ll use Aspose.PDF for .NET API, which is a feature-rich, powerful, and easy-to-use document manipulation API for .NET. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.

Package Manager Console

PM > Install-Package Aspose.PDF

Extract PDF Metadata via C#


To try the code in your environment, you need Aspose.PDF for .NET.

  1. Load the PDF with an instance of Document.
  2. Get DocumentInfo using Document.Info property.
  3. Access & display different Document.Info properties.

System Requirements


Just make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with .NET Framework, .NET Core, and PHP, VBScript, Delphi, C++ via COM Interop.
  • Development environment like Microsoft Visual Studio.
  • Aspose.PDF for .NET DLL referenced in your project.

Extract Metadata of PDF - C#.

This sample code shows how to extract metadata informations of the PDF file

    Document pdfDocument = new Document(dataDir + "GetFileInfo.pdf");
    DocumentInfo docInfo = pdfDocument.Info;
    Console.WriteLine("Author: {0}", docInfo.Author);
    Console.WriteLine("Creation Date: {0}", docInfo.CreationDate);
    Console.WriteLine("Keywords: {0}", docInfo.Keywords);
    Console.WriteLine("Modify Date: {0}", docInfo.ModDate);
    Console.WriteLine("Subject: {0}", docInfo.Subject);
    Console.WriteLine("Title: {0}", docInfo.Title);