Add Metadata to PDF in Node.js SDK
Add a Metadata to a PDF Document using Cloud Node.js SDK
Get StartedHow to create Metadata via Node.js SDK
To create 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 create a Metadata via Cloud Node.js
Aspose.PDF Cloud developers can easily load & create metadata in PDF in just a few lines of code.
- Reads the PDF file from the local file system.
- Uploads the PDF file to the Aspose.PDF Cloud storage.
- Creates metadata property object with a key, value, and namespace URI.
- Adds the metadata property to the PDF file using the Aspose.PDF Cloud API.
- Logs the status of the operation to the console.
Create XMP Metadata Properties in PDF using Node.js
const fs = require("fs");
const { PdfApi } = require("asposepdfcloud");
async function addXmpMetadataProperty()
{
const api = new PdfApi("YOUR_API_SID", "YOUR_API_KEY");
const fileName = "Test.pdf";
const folder = "Documents";
const storage = null;
const password = null;
const xmpMetadataProperty = "pdf:Prop";
const buffer = fs.readFileSync(fileName);
await api.uploadFile(folder + "/" +fileName, buffer, storage)
var pdfPropProperty = {
key: xmpMetadataProperty,
value: "PropValue",
namespaceUri: "http://ns.adobe.com/pdf/1.3/"
};
const xmpMetadata = {
properties: [pdfPropProperty]
};
const result = await api.postXmpMetadata(fileName, xmpMetadata, folder, storage, password);
console.log(result.body.status);
}
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 add metadata to PDF files online and test the functionality.
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Why Aspose.PDF Cloud for Node.js?
- Customers List
- Security