This page describes how to use our cloud-based API to join multiple PDF files or update PDF attributes in Node.js. The API is user-friendly and can be integrated into your application with just a few lines of code.
The Node.js API client library provides easy access to the Pdfcrowd API. No third-party libraries are required.
Install the client library from npmnpm install pdfcrowd
We also offer other installation options.
The credentials to access the API are your Pdfcrowd username and the API key. You can try out the API without registering using the following demo credentials:
demo
ce544b6ea52a5621fb9d55f8b542d14d
To get your personal API credentials, you can start a free API trial or buy the API license.
Refer to the PDF to PDF Node.js Reference for a description of all API methods.
Here are a few Node.js examples to get you started quickly with the API. See more examples.
var pdfcrowd = require("pdfcrowd"); // create the API client instance var client = new pdfcrowd.PdfToPdfClient("demo", "ce544b6ea52a5621fb9d55f8b542d14d"); // configure the conversion try { client.addPdfFile("/path/to/cover.pdf"); client.addPdfFile("/path/to/proposal.pdf"); client.addPdfFile("/path/to/price.pdf"); client.addPdfFile("/path/to/contact.pdf"); } catch(why) { // report the error console.error("Pdfcrowd Error: " + why); process.exit(1); } // run the conversion and write the result to a file client.convertToFile( "offer.pdf", function(err, fileName) { if (err) return console.error("Pdfcrowd Error: " + err); console.log("Success: the file was created " + fileName); });
var pdfcrowd = require("pdfcrowd"); var fs = require("fs"); // create the API client instance var client = new pdfcrowd.PdfToPdfClient("demo", "ce544b6ea52a5621fb9d55f8b542d14d"); // configure the conversion try { client.addPdfRawData(fs.readFileSync("/path/to/cover.pdf")); client.addPdfRawData(fs.readFileSync("/path/to/proposal.pdf")); client.addPdfRawData(fs.readFileSync("/path/to/price.pdf")); client.addPdfRawData(fs.readFileSync("/path/to/contact.pdf")); } catch(why) { // report the error console.error("Pdfcrowd Error: " + why); process.exit(1); } // run the conversion and write the result to a file client.convertToFile( "offer.pdf", function(err, fileName) { if (err) return console.error("Pdfcrowd Error: " + err); console.log("Success: the file was created " + fileName); });
var pdfcrowd = require("pdfcrowd"); // create the API client instance var client = new pdfcrowd.PdfToPdfClient("demo", "ce544b6ea52a5621fb9d55f8b542d14d"); // configure the conversion try { client.addPdfFile("/path/to/proposal.pdf"); client.setPageWatermark("/path/to/watermark.pdf"); } catch(why) { // report the error console.error("Pdfcrowd Error: " + why); process.exit(1); } // run the conversion and write the result to a file client.convertToFile( "company_offer.pdf", function(err, fileName) { if (err) return console.error("Pdfcrowd Error: " + err); console.log("Success: the file was created " + fileName); });