Merge PDFs by page range(s)
POST https://api.pdfrest.com/merged-pdf
This request demonstrates how to merge specific pages from multiple PDFs into a single document.
The following parameters are used, once for each input document:
file
orid[]
- 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 eachfile
andid[]
specified.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.
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"=>"pages[]", "value"=>"1-10", "datatype"=>"string"}, {"name"=>"type[]", "value"=>"file", "datatype"=>"string"}, {"name"=>"id[]", "value"=>"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "datatype"=>"string"}, {"name"=>"pages[]", "value"=>"2,3,5", "datatype"=>"string"}, {"name"=>"type[]", "value"=>"id", "datatype"=>"string"}, {"name"=>"id[]", "value"=>"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "datatype"=>"string"}, {"name"=>"pages[]", "value"=>"odd", "datatype"=>"string"}, {"name"=>"type[]", "value"=>"id", "datatype"=>"string"}, {"name"=>"file", "value"=>nil, "datatype"=>"null"}, {"name"=>"pages[]", "value"=>"even", "datatype"=>"string"}, {"name"=>"type[]", "value"=>"file", "datatype"=>"string"}, {"name"=>"output", "value"=>"pdfrest_merged_pdf", "datatype"=>"string"}]
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Api-Key | string |