In this tutorial, we will show you how to merge PDFs, images, and documents into a single file in JavaScript using PDF.co Web API. Below is the image of our sample source files and the single PDF output.

Step 1 – Source Code
Let’s copy the PDF Merger source code here and save it as app.js.
Step 2 – Add API Key
In line 21, let’s add our PDF.co API Key as API_Key variable’s value. You can get your API Key in the dashboard here.
Step 3 – Source Files URL
In line 25, enter the source file links separated by a comma. You can check out the API Docs for the supported file formats. Then, add the destination PDF file name in line 30.
Step 4 – Run Program
Now, let’s run our program. Type in node app.js
in the Terminal. Be sure to set the correct path to your file before you run the command.
Step 5 – PDF Output
Great! Let’s check the folder to see the PDF result.
Step 6 – PDF Merger Demo
Here’s the PDF Merger in action.

In this tutorial, you learned how to merge PDFs, images, and documents in JavaScript using PDF.co Web API. You also learned how to set up the source code to get you started right away.