Split PDFs
Cuts a PDF into several, which come back in a ZIP.
POST/forms/pdf/split
Form data
Options
Split every page
curl \
--request POST http://localhost:3000/forms/pdf/split \
--form files=@report.pdf \
--form every=1 \
-o report.zip
The answer is a ZIP of report_0.pdf, report_1.pdf and report_2.pdf. every: 2 cuts every two pages instead, and every is at least 1. A split that yields one part answers that PDF, not a ZIP: every: 5 on this three-page report answers report_0.pdf.
Split by ranges
ranges gives one PDF per entry, each a page selection:
curl \
--request POST http://localhost:3000/forms/pdf/split \
--form files=@report.pdf \
--form 'ranges=[
"1",
"2-3"
]' \
-o report.zip
Process each part
The stages after a split run on each part. This one stamps both parts:
curl \
--request POST http://localhost:3000/forms/pdf/pipe \
--form files=@report.pdf \
--form 'stages=[
{ "op": "split", "ranges": [ "1", "2-3" ] },
{ "op": "stamp-text", "text": "DRAFT", "x": 36, "y": 36, "fontSize": 18 }
]' \
-o report.zip
In a list of stages
The stage also runs in a list on /forms/pdf/pipe, and on the PDFs a Chromium or LibreOffice conversion makes, in its stages field:
curl \
--request POST http://localhost:3000/forms/pdf/pipe \
--form files=@report.pdf \
--form 'stages=[
{ "op": "split", "ranges": [ "1", "2-3" ] }
]' \
-o report.zip
To keep some pages in one PDF rather than cut it, select them.