In this tutorial, we will show you how to merge PDFs, images, and documents into a single file in PHP using Web API. The image below shows the source files and the single PDF output.

Input Files And Output PDF
Input Files and Output PDF

Step 1 – Source Code

To begin, let’s copy the HTML and the PHP source code here. Save it in a folder inside the /www or /htdocs directory depending on whether you are using XAMPP or WampServer

Save Source Code In Folder

Step 2 – Start Apache

Next, let’s start the Apache server so we can run the program on our local machine.

Step 3 – Run Program

Now, let’s run our program. Type in localhost/folder_name/sample.html in your browser. Then, enter your API Key and the files to merge. You can get your API Key in the dashboard here.

Run Program

NOTE: You can get a copy of our sample files here.

Step 4 – Merged Files Output will return a temporary URL to access the merged files. Kindly open the URL to see the result.

Merged Output URL

Step 5 – PDF Merger Demo

Here’s the PDF Merger in action.

Merge Any Documents Demo
Merge Any Documents Demo

In this tutorial, you learned how to merge PDFs, images, and documents in PHP using Web API. You also learned how easy it is to set up the code samples to get your program running right away.

Related Pages:

Related Samples: