Merge PDF in Node.js SDK
Merge several PDF files in Node.js Cloud API without the use of any software like Adobe PDF.
Get StartedHow to Merge several PDF Files Using Node.js SDK
Now, managing and organizing documents is essential for businesses and individuals. Merging multiple PDF files into one document simplifies sharing, archiving, and printing. Whether you need to combine multiple reports, invoices, or contracts, merging PDFs offers a clean, organized solution. With Aspose Cloud Node.js Library, you can easily merge multiple PDF documents programmatically using the power of cloud computing. This guide will walk you through merging PDF files using Aspose’s Cloud API in Node.js.
Why do I need to merge multiple PDF documents?
Combine multiple related documents into a single file for easy management. Merge invoices, receipts, or reports for a client into a single file for streamlined sharing. Reduce the number of files in storage by consolidating them into one compact document. Save time by automating the process of merging multiple files.
Merge PDFs with Node.js
The PDF Cloud Node.js SDK offers an easy-to-use and secure API for merging PDF files quickly and accurately, even when dealing with complex formatting. Instead of manually combining files, you can merge them in seconds with just a single method call from the Node.js SDK. There’s no need to install additional software—document merging happens in the cloud, offloading the process from your local system and saving resources.
Package Manager Console Command
npm install asposepdfcloud --save
Steps for Merging PDF via Cloud Node.js
A basic merging pdfs programmatically with Aspose.PDF Cloud Node.js SDK APIs can be done with just few lines of code.
- Import the necessary classes.
- Reads a PDF files from the local file system.
- Upload the PDF files to the Aspose.PDF Cloud storage.
- Merge the PDF documents using the Aspose.PDF Cloud API.
- Log the result to the console.
- Download the result if needed it
Merge several PDF Files using Node.js
const fs = require("fs");
const { PdfApi } = require("asposepdfcloud");
const { MergeDocuments } = require("asposepdfcloud/src/models/mergeDocuments");
async function mergeDocument()
{
const api = new PdfApi("YOUR_API_SID", "YOUR_API_KEY");
const fileName = "merged.pdf";
const fileNames = ["Sample.pdf", "Sample2.pdf"];
const storage = null;
const folder = "Documents";
const mergeRequest = new MergeDocuments();
mergeRequest.list = [];
await Promise.all(
fileNames.map(async fileName =>
{
const buffer = fs.readFileSync(fileName);
await api.uploadFile(folder + "/" + fileName, buffer, storage);
mergeRequest.list.push(folder + "/" + fileName);
})
);
const result = await api.putMergeDocuments(
fileName,
mergeRequest,
storage,
folder);
console.log(result.body.status);
}
Combine Features and Capabilities
We offer top-tier document processing capabilities through our continually advancing Cloud SDKs, which support a variety of programming languages and major platforms. These tools empower developers to fully control and tailor document merging options to meet their unique requirements.
With our Node.js tool 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 merge 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