In this tutorial, we’re going to see how we can merge two PDF files using the PDF merging Web API by PDF.co. We’re having the Java implementation for this and we’re going to see how we can do this call in Java. So the approach is the same regardless of whatever language or framework you’re using.
1. Input Details of Files to be Merged
So first of all, we have the placeholder for the API keys, which we provide here. We have two input files. There are two PDF files of the two pages, so the output should be the two pages. We provided the destination file here and an API endpoint. We’re going to use them if you like a v1 PDF merge. We will provide the name of the output file and we will provide the URLs in the comma-separated format.
2. Prepare the Request
Here we prepare the request. We provide the API key in the header. We execute the request and if the request goes well, we pass it to the JSON here. Then we’re going to get the URL of the regenerated file, save it here and download it.
We created one function here. So what it does, basically, it prepares the request for downloading. It calls a web client, gets the destination file using the file output stream. I replace the keys here and execute the program. The project is being finished.
3. Check the Output
Now, we will examine the output. So, it has generated the result PDF and we can see it contains the two pages – page one from the first input and page two from the second input.
So it’s easy to merge the PDF files using the PDF merging API by PDF.co.
GET YOUR API KEY Zapier plugin Explore API Docs
Check this PDF.co video tutorial using PDF.co Web API and follow us on YouTube!
PDF.co video tutorial
PDF.co REST Web API tutorials
- Introduction to PDF.co Web API
- How to Convert Images to PDF
- How to Convert PDF to Image
- How to Find PDF Information
- How to Make PDF Searchable
- How to Merge PDF using API
- How to Split PDF into Pages
- How to Search PDF for Text
- Add Image to Existing PDF
- Add Text to Existing PDF
- How to Convert PDF to Text
- How to Convert PDF to JSON
- How to Convert PDF to XML
- How to Convert PDF to HTML
- How to Generate BarCodes
- How to Read BarCodes