Split PDFs
Cut a PDF into parts every few pages, or take out the pages you choose.
POST https://api.pdfdispatch.com/v1/pdf/split
Form fields
| Field | Type | Default | What it does |
|---|---|---|---|
files required | file(s) | – | The PDFs to split. |
splitMode required | string | – | intervals: a new file every splitSpan pages. pages: take the pages in splitSpan. |
splitSpan required | string | – | For intervals, a number of pages (2: pages 1-2, 3-4, …). For pages, a selection: 1-3, 5, 7- (7 to the end), even, odd, !2 (all but 2), joined with commas. |
splitUnify | boolean | false | pages mode only: put the selected pages into one PDF instead of one file per page. |
flatten | boolean | false | Flatten form fields and annotations of the parts. |
And the options on conversion routes, applied to each part. splitMode and splitSpan
also work on the conversion routes themselves: convert a long document and get it in parts.
What comes back
intervals, orpageswithoutsplitUnify: a ZIP. The parts are named after the input with a number:report_0.pdf,report_1.pdf, …pageswithsplitUnify=true: one PDF with the selected pages.
Examples
Every two pages into a file of their own:
curl --fail-with-body \
--header "Authorization: Bearer $PDD_KEY" \
--form files=@tickets.pdf \
--form splitMode=intervals \
--form splitSpan=2 \
--output tickets.zip \
https://api.pdfdispatch.com/v1/pdf/split
The first page and pages 4 to 6, as one PDF:
curl --fail-with-body \
--header "Authorization: Bearer $PDD_KEY" \
--form files=@contract.pdf \
--form splitMode=pages \
--form splitSpan=1,4-6 \
--form splitUnify=true \
--output excerpt.pdf \
https://api.pdfdispatch.com/v1/pdf/split