Extract PDF Metadata via JavaScript

Extract metadata from PDF document. Use Aspose.PDF for Node.js via C++ to modify PDF files programmatically

How to Extract PDF Metadata Using Node.js via C++

Extract metadata from PDF using Aspose.PDF for Node.js. Accessing a document’s metadata means getting information about that file, such as its title, author, when it was created, and specific keywords. Extracting metadata helps organize a large collection of PDFs more effectively. The data extracted from metadata improves how you can search for files. Users can quickly locate specific documents using keywords or details in the extracted metadata. Extracting metadata gives valuable insights into what a file contains. It might offer a brief summary of key details about the file, making it easier to understand the document without having to open it. Extracting metadata helps ensure a document is authentic. You can check details like the author’s name when it was created or its modification history. This verification is crucial for confirming a PDF’s reliability. By offering concise details about the content of a PDF, the extracted metadata makes the user experience much better. It helps users easily identify and work with documents. Extracting PDF metadata gives many advantages, such as more efficient document management, improved search options, compliance with standards, and an enhanced user experience. Extract metadata from PDF via Aspose and solve all the necessary tasks in the work with data. The Aspose.PDF for Node.js via C++ helps extract information embedded in a PDF document that describes its properties, attributes, and content. This includes information such as title, author, creator, author, theme, keywords, and dates of creation/modification of the PDF of the document. Extracting these metadata can be useful for organizing, classifying, and searching specific PDF files, depending on their properties. To get the PDF file information, we’ll use Aspose.PDF for Node.js via C++, an easy and secure toolkit used to work with PDF directly in the web browser. To install and use Aspose.PDF for Node.js via C++, extract files from the ZIP archive.

Extract PDF Metadata via JavaScript


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

  1. Import the Aspose.PDF module.
  2. Define a constant for input file.
  3. Call the AsposePdf function. Call the AsposePdfGetInfo Use the console.log method

The provided JavaScript code snippet shows how to extract metadata from PDF by Aspose.PDF library. It opens a PDF file named ‘GetFileInfo.pdf’ located in the directory specified by the variable ‘DIR_INPUT_METADATA’. The code retrieves various details from the document using the ‘info’ function. It displays specific metadata information from the PDF, such as the author’s name, creation date, keywords, modification date, subject, and title. The code uses the ‘print’ function to show this information. This code snippet is a simplified example of how you might use a Aspose.PDF library or framework to extract metadata from PDF file.

Extract Metadata of PDF - JavaScript

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

Input file:

File not added

Output format:

Output file:

const AsposePdf = require('../AsposePDFforNode.js');
const pdf_file = '../ReadMe.pdf';
AsposePdf().then(AsposePdfModule => {
    /*Get info (metadata) from a PDF-file*/
    const json = AsposePdfModule.AsposePdfGetInfo(pdf_file);
    console.log("AsposePdfGetInfo => %O", json.errorCode == 0 ? 'Title: ' + json.title : json.errorText);
});