Combine PDFs

Purpose

Combine two or more PDF documents into a single PDF. You can also combine selected pages or a specific range of pages from each input document.

Quick Reference

PropertyValue
MethodPOST
Request URLhttps://{api.office-integrator_domain}/writer/officeapi/v1/documents/pdf/combine
Content-Typemultipart/form-data

Parameters

Body Parameters

ParameterValueMandatory/OptionalDescription
apikey423s*****MandatoryUniquely identifies the web application which initiates the PDF combine request.
filesFileMandatory

To upload the input PDF files from your local drive or desktop. 
Note
 

  • Up to 5 input PDF files can be combined at once.
  • File size limit will be up to 10 MB for each file.
output_settings{
 "name": <filename>
}
Optionalname -> Specify a unique name for the merged or combined output file. By default, the output file name will be output.pdf.
input_options{
 "1": {
  "page_ranges": "3,5,7"
 },
 "2": {
  "page_ranges": "1-3, 5"
 }
}
Optionalpage_ranges -> It is possible to combine selected pages or a specific range of pages in a document.
To combine selected pages, pass the respective page numbers with comma separated (say 3,5,7,etc.).
To combine a specific range of pages, pass the page ranges with a hyphen (say 1-3).

Notes and Limits

  • Up to 5 input PDF files can be combined at once.
  • File size limit is up to 10 MB for each file.
  • The combined PDF document response will be downloaded as bytes.
  • By default, the output file name will be "output.pdf".
  • For other server-side SDK sample code, refer to: Server-Side SDKs

Sample Request

Copiedcurl --location --request POST "https://api.office-integrator.com/writer/officeapi/v1/documents/pdf/combine?apikey=423s*****" \
  --header "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" \
  --form 'output_settings="{\"name\":\"CombinedFile.pdf\"}"' \ 
  --form 'files=@"/Users/username/Documents/Sample1.pdf"' \ 
  --form 'files=@"/Users/username/Documents/Sample2.pdf"' \ 
  --form 'input_options="{\"1\":{\"page_ranges\":\"3,5,6\"},\"2\":{\"page_ranges\":\"1-3,6\"}}"' 

Sample Response

The combined PDF document will be downloaded as bytes.