The PDF.co PDF Merger API can merge a mix of different document formats into a single PDF. This API function can save you time and effort by taking away the hassle of converting the non-PDF to PDF before they can be merged.
Following are the supported document formats in PDF Merger:
- PDF files;
- DOC / DOCX / RTF/ Word documents;
- XLS / XLSX / CSV / spreadsheets;
- JPG / PNG / TIFF images;
- TXT files;
- EML / MSG email messages with attachments;
- ZIP with documents and pictures.
There are two PDF Merger API endpoints.
- /v1/pdf/merge2 – merge all supported formats
- /v1/pdf/merge – merge PDF files only
PDF Merger API Benefits
PDF and Non-PDF File Support
Our PDF.co Web API engine supports different document formats. You can mix and merge different file formats in one go. The supported formats are listed in the table above.
Merge Large Files
The PDF Merger API can process large files using the async parameter.
PDF Format as Output
The PDF Merger API output format is in PDF. When images or other non-PDF files are merged using the /v1/pdf/merge2 endpoint the output format is in PDF as well.
Web API Supports Multiple Languages
PDF.co platform can be used by software developers from programming languages such as PHP, Javascript, .NET and ASP.NET, C#, Java, Visual Basic, and many others. Find source code samples in our API documentation.
Business Automation Platforms Integrations
If you are not a developer, you can also easily automate your PDF operations via popular business automation platforms: Zapier, Make, Airtable, Salesforce, Google Apps Script, and 300+ more.
PDF Merger API Sample & Demo
Here are the source code samples and demos accordingly:
PDF Merge 2 Endpoint
As mentioned above, there are 2 PDF Merger endpoints. Because of the difference in file support, we will show different source code samples for each endpoint.
To demonstrate the /v1/pdf/merge2 endpoint, we will use these five (5) sample documents with different file formats. There's a PDF file, a Word document, a Spreadsheet, a JPG, and a PNG.
Screenshots of PDF Merger 2 Source Files With Different Formats
Once the request has been processed. All the documents will be merged into a single PDF.
Screenshots of PDF Merger 2 Output PDF
Now let's take a quick look at the /v1/pdf/merge2 endpoint's parameters and their uses.
Endpoint
URL: | https://api.pdf.co/v1/pdf/merge2 |
Method: | POST |
Parameter | Description |
url | required. Comma-separated links to source files. |
encrypt | optional. Enable encryption for the output file: true or false |
async | optional. Runs processing asynchronously. Returns jobId to use with job/check : true or false |
name | optional. Output file name. |
profiles | optional. Must be a String. Set custom configuration. See profiles examples here |
cURL Code Snippet for PDF Merge 2
curl --location --request POST 'https://api.pdf.co/v1/pdf/merge2' --header 'x-api-key: {{x-api-key}}' --form 'url=https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample1.pdf,https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/doc-to-pdf/sample.docx' --form 'name=result.pdf'
This sample code and other cURL source code samples are available here.
Let's see the PDF Merge 2 in action using cURL.
Call /v1/pdf/merge2 Endpoint Using cURL
The PDF Merge2 JavaScript source code samples are available here.
The PDF Merge2 PHP source code samples are available here.
The sample code for PDF Merge2 in Python is here.
The PDF Merge2 Java source code samples are available here.
The PDF Merge2 C# source code samples are available here.
PDF Merge Endpoint
The /v1/pdf/merge has the same function as PDF Merge 2 except that the file support for this endpoint is exclusively in PDF format. If all of your source files are in PDF format, we recommend that you use this endpoint, otherwise, the /v1/pdf/merge2 endpoint would work best for you.
To demonstrate /v1/pdf/merge, we will use these two (2) PDF files and merge them into a single file.
Screenshots of Two PDF Files to Merge
When PDF.co process the request successfully, the output file will look like this.
Screenshot of Merged PDF Output File
Let's quickly go over the /v1/pdf/merge endpoint's parameters and their uses.
Endpoint
URL: | https://api.pdf.co/v1/pdf/merge |
Method: | POST |
Parameter | Description |
url | required. Comma-separated links to source files. |
encrypt | optional. Enable encryption for the output file: true or false |
async | optional. Runs processing asynchronously. Returns jobId to use with job/check : true or false |
name | optional. Output file name. |
profiles | optional. Must be a String. Set custom configuration. See profiles examples here |
cURL Code Snippet for PDF Merge
curl --location --request POST 'https://api.pdf.co/v1/pdf/merge' --header 'x-api-key: {{x-api-key}}' --form 'url=https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample1.pdf,https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample2.pdf' --form 'name=result.pdf'
PDF Merge cURL source code samples are available in our repository here.
Let’s see the PDF Merge in action using cURL.
Calling /v1/pdf/merge Endpoint using cURL
PDF Merge JavaScript code snippets are available in our repository here.
PDF Merge PHP code snippets are available in our repository here.
The sample code for PDF Merge in Python is here.
PDF Merge Java code snippets are available in our repository here.
PDF Merge C# code snippets are available in our repository here.