HTML JPG PDF XML DOCX
  Product Family
PDF

Get Metadata from PDF in Node.js SDK

Get all of the metadata from the PDF document using Cloud Node.js SDK

Get Started

How to get Metadata via Node.js SDK

To get Metadata, we’ll use Aspose.PDF Cloud Node.js SDK. This Cloud SDK assists Node.js programmers in developing cloud-based PDF creator, annotator, editor, and converter apps using Node.js programming language via Aspose.PDF REST API. Simply create an account at Aspose for Cloud and get your application information. Once you have the App SID & key, you are ready to give the Aspose.PDF Cloud Node.js SDK.

Package Manager Console Command


     
    npm install asposepdfcloud --save
     
     

Steps to get Metadata via Cloud Node.js

Aspose.PDF Cloud developers can easily load & get metadata from PDF in just a few lines of code.

  1. Reads the PDF file from the local file system.
  2. Uploads the PDF file to the Aspose.PDF Cloud storage.
  3. Retrieve the XMP metadata properties from the PDF file.
  4. Log the XMP metadata properties to the console.
 

Get Metadata from PDF using Node.js


    const fs = require("fs");
    const { PdfApi } = require("asposepdfcloud");

    async function getXmpMetadataProperty()
    {
        const api = new PdfApi("YOUR_API_SID", "YOUR_API_KEY");
        const fileName = "Sample.pdf";
        const folder = "Documents";
        const storage = null;
        const password = null;
        
        const buffer = fs.readFileSync(fileName);
        await api.uploadFile(folder + "/" +fileName, buffer, storage)

        const metadata = await api.getXmpMetadataJson(fileName, folder, storage, password);  
        console.log("XMP metadata:");
        metadata.body.properties.forEach(property => 
        {
            console.log("    " + property.key + " = " + property.value);
        });
    }
 

Work with Metadata in PDF

Working with metadata in PDF files is important. Metadata such as the title field, author and theme help classify documents, making it easier to manage large collections of documents by providing a quick overview of content without opening files. Metadata also improves file search by allowing you to search by keywords and attributes. This is particularly valuable in systems where the rapid retrieval of documents is essential. Add metadata into PDF documents with Aspose.PDF Cloud Node.js SDK.

With our Node.js library you can:

  • Add PDF document’s header & footer in text or image format.
  • Add tables & stamps (text or image) to PDF documents.
  • Append multiple PDF documents to an existing file.
  • Work with PDF attachments, annotations, & form fields.
  • Apply encryption or decryption to PDF documents & set a password.
  • Delete all stamps & tables from a page or entire PDF document.
  • Delete a specific stamp or table from the PDF document by its ID.
  • Replace single or multiple instances of text on a PDF page or from the entire document.
  • Extensive support for converting PDF documents to various other file formats.
  • Extract various elements of PDF files & make PDF documents optimized.
  • You can try out our free App to get metadata from PDF files online and test the functionality.