Extract PDF Metadata via C++

How to Edit PDF Metadata Using C++ Library

Aspose.PDF for C++ Logo

How to Extract PDF Metadata Using C++ Library

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

Package Manager Console

PM > Install-Package Aspose.PDF.Cpp

Extract PDF Metadata via C++

You need Aspose.PDF for C++ to try the code in your environment.

  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 C++ Runtime Environment for Windows 32 bit, Windows 64 bit, and Linux 64 bit.
  • Development environment like Microsoft Visual Studio.
  • Aspose.PDF for C++ DLL referenced in your project.

Extract Metadata of PDF - C++.

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

    auto pdfDocument = MakeObject<Document>(_dataDir + u"SetFileInfo.pdf");
    auto docInfo = MakeObject<DocumentInfo>(pdfDocument);
    docInfo->set_Keywords (u"Aspose.Pdf, DOM, API");
    docInfo->set_ModDate (DateTime::get_Now());
    docInfo->set_Subject (u"PDF Information");
    docInfo->set_Title (u"Setting PDF Document Information");
    // Save output document
    pdfDocument->Save(_dataDir + u"SetFileInfo_out.pdf");

About Aspose.PDF for C++ API

Aspose.PDF API can be used for PDF document manipulation and parsing within applications. One can create, modify, compress, secure, print or save PDF to TXT, HTML, PCL, XFA, XML, XPS, EPUB, TEX, Images and more formats. Aspose.PDF is a standalone API and it does not depend on any software including Adobe Acrobat.