Pdf Merge API

SelectPdf Pdf Merge REST API is an online solution that lets you merge local or remote PDFs into a final PDF document. The API is easy to use, the integration can be done in a few minutes with only a few lines of code.

GET A DEMO LICENSE KEY NOW

The free trial key for the online API is valid for 7 days and it includes 200 conversions.

Features

  • Merge local PDF document.
  • Merge remote PDF from public url.
  • Set PDF viewer options and PDF document information.
  • Secure generated PDF with a password.
  • Works in all programming languages.

Usage

It’s very easy to use SelectPdf Pdf Merge REST API. All you need is a license key and you will be able to merge your PDFs in an instant. If you want to see how to do this in PHP, Java, Ruby, Python, Perl, Node.JS, C# or VB.net, click here to go directly to the coding examples.

Here is a basic usage example using a POST request:

API endpoint: https://selectpdf.com/api2/pdfmerge/
Method: POST
Content Type: multipart/form-data

POST /api2/pdfmerge/ HTTP/1.1
Content-Type: multipart/form-data; boundary=—011000010111000001101001
Host: selectpdf.com
Content-Length: 543

—–011000010111000001101001
Content-Disposition: form-data; name=”key”

_put___your___license___key___here__
—–011000010111000001101001
Content-Disposition: form-data; name=”files_no”

2
—–011000010111000001101001
Content-Disposition: form-data; name=”url_1″

https://selectpdf.com/demo/files/selectpdf.pdf
—–011000010111000001101001
Content-Disposition: form-data; name=”url_2″

https://selectpdf.com/demo/files/selectpdf.pdf
—–011000010111000001101001–

Options

Mandatory Parameters

SelectPdf Pdf Merge REST API has only 2 mandatory parameters. The rest of the parameters are optional. When they are missing, the default value is used.

Parameter Description
key Your API license key
files_no Number of PDF files that will be merged

Merged PDF documents

PDF documents that will be merged can be specified using public urls or local files can be uploaded. There is a naming convention for these files:

– url_{idx} (used for remote urls)

  –or–

– file_{idx} (used for uploaded files)
 

{idx} will be a number from 1 to the value specified in files_no parameter.
An additional password_{idx} parameter can be specified for each file, if a password is needed to access the PDF.

For example, if 4 files are merged, the parameters sent to the API should look like this:

url_1 – remote url
(optional password_1)

file_2 – local uploaded file
(optional password_2)

url_3 – remote url
(optional password_3)

file_4 – local uploaded file
(optional password_4)

Pdf Options

Use the following parameters to control the PDF document information, security and the look when the document is opened in a client PDF viewer.

Parameter Description
doc_title Specifies the pdf document title.
doc_subject Specifies the subject of the pdf document.
doc_keywords Specifies the pdf document keywords.
doc_author Specifies the name of the pdf document author.
doc_add_creation_date If this is set, the date and time when the pdf document was created is saved in pdf document information. All possible values are: True, False. The default value is False.
   
viewer_page_layout Sets the page layout to be used when the document is opened. All possible values:
  0 – Single Page (displays one page at a time),
  1 – One Column (displays the pages in one column),
  2 – Two Column Left (displays the pages in two columns, with odd-numbered pages on the left),
  3 – Two Column Right (displays the pages in two columns, with odd-numbered pages on the right).
The default value is 1 – One Column.
viewer_page_mode Sets the document page mode when the pdf document is opened in a pdf viewer. All possible values:
  0 – Use None (neither document outline / bookmarks nor thumbnail images are visible)
  1 – Use Outlines (document outline / bookmarks are visible)
  2 – Use Thumbs (page thumbnail images are visible)
  3 – Full Screen (full-screen mode, with no menu bar, window controls or any other window visible)
  4 – Use OC (optional content group panel is visible)
  5 – Use Attachments (document attachments are visible)
The default value is 0 – Use None.
viewer_center_window Sets a flag specifying whether to position the document’s window in the center of the screen. All possible values are: True, False. The default value is False.
viewer_display_doc_title Sets a flag specifying whether the window’s title bar should display the document title taken from document information. All possible values are: True, False. The default value is False.
viewer_fit_window Sets a flag specifying whether to resize the document’s window to fit the size of the first displayed page. All possible values are: True, False. The default value is False.
viewer_hide_menu_bar Sets a flag specifying whether to hide the pdf viewer application’s menu bar when the document is active. All possible values are: True, False. The default value is False.
viewer_hide_toolbar Sets a flag specifying whether to hide the pdf viewer application’s tool bars when the document is active. All possible values are: True, False. The default value is False.
viewer_hide_window_ui Sets a flag specifying whether to hide user interface elements in the document’s window (such as scroll bars and navigation controls), leaving only the document’s contents displayed. All possible values are: True, False. The default value is False.
   
user_password Specifies a password needed to be able to view the generated pdf document.
owner_password Specifies a password needed to be able to view or modify the generated pdf document.
   
pdf_name Specifies the name of the pdf document that will be created. The default value is Document.pdf.

Return Codes

Our API returns HTTP response codes, which you can check to see if the conversion was successful or not. Here is the list of HTTP codes used by SelectPdf REST API:

Code Description
200 OK The API call succeeded.
400 Bad Request Uploaded PDF files or urls do not match the specified number of files or naming conventions. The body of the response contains an explanation in plain text.
401 Authorization Required License key not specified or invalid. The body of the response contains an explanation in plain text.
415 Unsupported Media Type The PDF Merge API requires data to be posted as multipart/form-data.
499 Custom Conversion error. The body of the response contains an explanation in plain text.

Remarks

  • Concurrency: depending on payment plan, the following number of concurrent requests can be sent to the API:
      Free Trial – 1 request
      Entry Level – 2 requests
      Standard Level – 4 requests
      Advanced Level – 8 requests
      Premium Level – 8 requests
      Ultra Level – 16 requests
      Dedicated Level – 16 requests.

    If more requests are sent, they are either queued or rejected with a Too Many Requests error.

  • PDF file size: The API accepts files up to 100Mb. Each 50 pages is counted as 1 conversion credit.

Code Examples

Pdf Merge in PHP

Pdf Merge in Java

Pdf Merge in Ruby

Pdf Merge in Python

Pdf Merge in C#

Pdf Merge in Go

Pdf Merge in Node.js

Test SelectPdf PDF Merge online RESTful API Now

Request a Demo License Key for SelectPdf REST API right now. Feel free to ask any questions if needed.
The free trial key for the online API is valid for 7 days and it includes 200 conversions.

SelectPdf for Cloud’s platform independent Pdf Merge API is a true REST API that can be used with any language: .NET, Java, PHP, Ruby, Rails, Python, jQuery and many more. You can use it with any language or platform that supports REST. Almost all platforms and languages support REST and provide native REST clients to work with REST APIs. You do not need to worry about language or platform limitations. You can use it with any platform – web, desktop, mobile, and cloud. Try now for free the best API to Merge PDFs.