Merge PDF FIles with PDF.co

The PDF.co PDF Merger API can merge a mix of different document formats into a single PDF. This will allow you to merge an image, a doc, a spreadsheet, and a PDF into a single PDF file. 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:

  • ZIP
  • XLS
  • TXT
  • DOC
  • XLSX
  • PNG
  • DOCX
  • RTF
  • JPG

There are two PDF Merger API endpoints.

The PDF.co API runs in a secure AWS Infrastructure. All files and documents processed by PDF.co are encrypted. For more information on PDF.co security check out https://pdf.co/security

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. The async runs the job processes asynchronously and returns a Job ID. This Job ID can be used to check the status of the job.

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.

On-Premise API Server

The PDF Merger API has an on-premise API version and an on-demand version. The on-premise API server is ideal for businesses that prefer to run their program and processes within their own premises. The PDF.co Web API is the on-demand version and all API calls are processed in an encrypted connection.

Sign Up

PDF Merger API Integrations

PDF.co API has over 300+ integrations. Explore them below:

PDF Merger API Sample & Demo

Here are the sample codes 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 sample codes 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.

PDF Merger Source Files With Different Formats
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.

PDF Merge 2 Output PDF File
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 sample codes are available here.

Let’s see the PDF Merge 2 in action using cURL.

Run PDF Merge 2 Using CURL
Call /v1/pdf/merge2 Endpoint Using cURL

The PDF Merge2 JavaScript sample codes are available here.

The PDF Merge2 PHP sample codes are available here.

The PDF Merge2 Java sample codes are available here.

The PDF Merge2 C# sample codes are available here.

Sign Up

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.

Two PDF Files As Source Files For PDF Merge
Screenshots of Two PDF Files to Merge

When PDF.co process the request successfully, the output file will look like this.

PDF Merge Endpoint 1 Output
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 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 sample codes are available in our repository here.

Let’s see the PDF Merge in action using cURL.

Run PDF Merge Endpoint 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.

PDF Merge Java code snippets are available in our repository here.

PDF Merge C# code snippets are available in our repository here.

Sign Up

Related Samples: