Watermark
Watermark PDF files - stamp a PDF with the text, image, or another fileExplore the product
It is easy to start converting documents using Node.js in a few simple steps:
Sign up for free and receive 250 conversions to try and evaluate our service. You will receive a free trial with no credit card required upon registration!
On your account dashboard you will access an intuitive UI tool that allows you to set up the conversion, adjust the parameters, and try the conversion online with zero code.
Once you have set up the conversion parameters and are happy with the conversion results, you will receive an auto-generated Node.js code snippet with your custom parameters!
Designed for performance and scalability, the ConvertAPI NodeJS library fits seamlessly into both traditional and modern deployment models, including containerized and serverless environments. With flexible parameters and detailed documentation, the ConvertAPI Node.js library is a versatile choice for building robust, high-efficiency document workflows.
High-performance and unbeatable accuracy document converter suite with support for over 500+ conversion.
Generate dynamic DOCX and PDF documents like invoices, contracts, reports, on the fly.
Protect, redact, compare, watermark, flatten, compress and modify your documents using ConvertAPI Node.js SDK.
Protect and unprotect PDFs, MS Office Powerpoint and MS Office Word documents.
Built to scale with your business, whether you're handling a few conversions or thousands.
Reduce file sizes without losing quality. Archive converters are designed to handle over 100 different file formats.
Configure your file conversion directly online using our intuitive interface. Select the desired parameters and see the results in real-time. Once you're satisfied, we’ll automatically generate the Node.js code for you, making integration into your project effortless. No need to start from scratch—just copy the code and implement it seamlessly into your Node.js application!
Get started nowThe ConvertAPI Node.js library offers a comprehensive solution for integrating high-quality document conversion and manipulation directly into your Node.js applications and services. Whether you need to transform PDFs into Office files, merge multiple documents, extract text from images, or handle other format conversions, the library covers a broad range of use cases and file types.
By leveraging Node.js’s asynchronous model, it lets you process documents in a highly scalable, non-blocking manner—ideal for modern, cloud-based architectures. Combined with Node.js’s event-driven architecture, the library helps you build fast, scalable, and secure document workflows that adapt to your evolving business needs.
To get started, install the ConvertAPI NodeJS SDK. Run this line from console:
npm install convertapi --saveThe WEB to PDF conversion lets you effortlessly transform entire web pages or HTML content into high-quality PDF files. Whether you’re capturing dynamic, user-generated pages or automating batch exports of reports, the library seamlessly turns live content into shareable, print-ready PDFs.
By allowing you to specify parameters such as page size, orientation, and output quality, you can tailor the final document to match your exact requirements. This streamlined approach makes it simple to generate visually consistent PDFs—perfect for archiving, distribution, or documentation within your Node.js applications.
Let's see how easy it is to perform a WEB to PDF conversion in a NodeJS application:
The ConvertAPI NodeJS library supports converting files from streams. This makes it easy to integrate document conversion into your existing Node.js applications, allowing you to process files without the need to store them on disk.
var fs = require('fs');
// set your api token
var convertapi = require('../lib')(process.env.CONVERT_API_TOKEN);
// Example of using readable stream to convert to pdf
// https://www.convertapi.com/docx-to-pdf
var dir = require('os').tmpdir();
// get readble stream (could be any readable stream)
var stream = fs.createReadStream('./examples/files/test.docx');
// Upload stream to the API. When uploading stream, file name must be provided.
var uploadResult = convertapi.upload(stream, 'test.docx');
convertapi.convert('pdf', { File: uploadResult })
.then(function(result) {
return result.saveFiles(dir);
})
.then(function(files) {
console.log("The PDF saved to\n" + files);
})
.catch(function(e) {
console.error(e.toString());
});
The ConvertAPI NodeJS library supports getting result file stream. This makes it easy to integrate document conversion into your existing Node.js applications, allowing for flexible handling of the output data.
// set your api token
var convertapi = require('../lib')(process.env.CONVERT_API_TOKEN);
// Example of converting Web Page URL to PDF and reading file data as string
// https://www.convertapi.com/web-to-pdf
var fromFormat = 'web';
var conversionTimeout = 180;
var https = require('https');
var Stream = require('stream').Transform;
var params = {
Url: 'https://en.wikipedia.org/wiki/Data_conversion',
FileName: 'web-example'
};
convertapi.convert('pdf', params, fromFormat, conversionTimeout)
.then(function(result) {
result.files.forEach(function(resultFile) {
console.log("Result url: " + resultFile.url);
https.get(resultFile.url, function(response) {
var stream = new Stream();
response.on('data', function(chunk) {
stream.push(chunk);
});
response.on('end', function() {
var data = stream.read()
console.log("Downloaded data size: " + data.length);
});
});
});
})
.catch(function(e) {
console.error(e.toString());
});
The ConvertAPI NodeJS library supports converting Base64 content. This example shows how to convert base64-encoded content into another format, facilitating the handling of data received in base64 encoding.
// set your api token
var convertapi = require('../lib')(process.env.CONVERT_API_TOKEN);
// Example of using buffer and stream to convert base64 encoded content to pdf
// https://www.convertapi.com/png-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EkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==";
// get buffer from base64 string
var buffer = Buffer.from(base64Content, 'base64');
// get readble stream from buffer
var stream = new Readable()
stream.push(buffer);
stream.push(null);
// Upload stream to the API. When uploading stream, file name must be provided.
var uploadResult = convertapi.upload(stream, 'test.png');
convertapi.convert('pdf', { File: uploadResult })
.then(function(result) {
return result.saveFiles(dir);
})
.then(function(files) {
console.log("The PDF saved to\n" + files);
})
.catch(function(e) {
console.error(e.toString());
});
The ConvertAPI NodeJS library supports conversion workflows. This makes it easy to integrate document conversion into your existing Node.js applications, allowing you to apply multiple, step-by-step transformations to the same document.
// set your api token
var convertapi = require('../lib')(process.env.CONVERT_API_TOKEN);
// Short example of conversions chaining, the PDF pages extracted and saved as separated JPGs and then ZIP'ed
// https://www.convertapi.com/doc/chaining
var dir = require('os').tmpdir();
console.log("Converting PDF to JPG and compressing result files with ZIP\n");
convertapi.convert('jpg', { File: './examples/files/test.pdf' })
.then(function(jpgResult) {
return convertapi.convert('zip', { Files: jpgResult });
})
.then(function(zipResult) {
return zipResult.saveFiles(dir);
})
.then(function(files) {
console.log("Files saved to\n" + files);
})
.catch(function(e) {
console.error(e.toString());
});
With our Node.js SDK, you can leverage a robust set of over 500+ features dedicated to document conversion and management—all from a single, streamlined toolkit.
The library effortlessly accepts documents from URLs, file streams, or local paths, ensuring a smooth fit within your existing Node.js workflows. For even greater efficiency, consider implementing conversion workflows, which let you sequentially apply multiple transformations to the same document.
If you’re seeking detailed examples or advanced tips, don’t miss our GitHub repository, where you’ll find everything you need to get the most out of the Node.js SDK.
Take control of your documents with our Node.js document management SDK. From basic conversions to full workflow automation, we provide the expertise and tools you need to manage your documents efficiently.
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
Explore the product
We ensure that all document processing is handled securely in the cloud, adhering to industry-leading standards like ISO 27001, GDPR, and HIPAA. To enhance security even further, we can ensure that no files or data are stored on our servers and never leave your country.
Learn more about securityHighest rated File Conversion API on major B2B software listing platforms: Capterra, G2, and Trustpilot.
"ConvertAPI has been a game-changer for our document automation workflows. Their conversion accuracy and API reliability are unmatched in the industry for over 7 years."
"ConvertAPI is a reliable, cost-effective solution with a proven track record of stability. It has grown significantly in maturity, adopting enterprise-grade practices over the years."
"We've integrated ConvertAPI across our entire document processing platform. The performance is exceptional and the support team is always responsive. Highly recommended!"
Unlike many specialized tools that focus on one or two tasks, the ConvertAPI Node.js library offers a comprehensive range of operations—covering everything from PDF splitting and Office file transformations to image manipulation—through a single, consistent interface.
Absolutely. The library’s lightweight structure fits well with serverless platforms. You simply package the library along with your function, and its asynchronous design helps handle time-sensitive executions without bogging down your environment.
The Node.js library supports multiple input methods. You can pass in file streams from user uploads, retrieve files from external endpoints (using their URLs), or reference local storage paths—whatever best aligns with your application’s workflow.
Yes. You can chain conversions so that each step’s output becomes the input for the next. For instance, you might convert a DOCX to PDF, then extract images, and finally compress those images, all in one automated sequence.
The Node.js library uses promise-based (or async/await) flows. You can catch errors using standard JavaScript error handling, allowing you to gracefully manage any issues, retry operations as needed, or log data for further analysis.
Yes. The official GitHub repository contains snippets, more in-depth examples, and documentation illustrating how to configure different conversion parameters and orchestrate complex workflows. It’s an excellent resource for picking up best practices or troubleshooting specialized scenarios.