Merge PDFs

POST https://api.pdfrest.com/merged-pdf

Merge PDFs into a single document.

Required form-data body parameters (per input document):

  • file or id[] - Upload a file or supply a resource ID, respectively.
  • pages[] - Page or range of pages to include in merged file. This parameter must be specified for each file and id[] specified. To include all pages of an input PDF document, set pages[] form-field body parameter to 1-last for that document.
  • type[] - Indicates whether a document is a new file to upload or an id for an existing file on the server. This is required to maintain the order of documents to merge. Must be set to either file or id.

Optional form-data body parameters:

  • output - File name for output file (without extension)

In addition to combinations of page numbers and page ranges, pages[] supports several keywords: even, odd, and last.

Examples of valid values for pages[] include:

  • 14-last (will merge using only the range of pages from page 14 to the end of the document)
  • 9-2 (will use pages 2 to 9 in reverse order)
  • 1,2,5-10,12-last
  • even (will use only the even-numbered pages from this document)
  • odd (will use only the odd-numbered pages from this document)

Request Body

[{"name"=>"file", "value"=>nil, "datatype"=>"null"}, {"name"=>"id[]", "value"=>"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "datatype"=>"string"}, {"name"=>"pages[]", "value"=>"1-last", "datatype"=>"string"}, {"name"=>"type[]", "value"=>"file", "datatype"=>"string"}, {"name"=>"output", "value"=>"pdfrest_merged_pdf", "datatype"=>"string"}]

HEADERS

KeyDatatypeRequiredDescription
Api-Keystring