Split by page ranges (page model)
1-based, comma-separated ranges such as 1-2,5; zero, out-of-bounds, descending, overlapping and malformed ranges return readable coded errors and keep the input.
Inputs and parameters
document— Single document page model (JSON)ranges— Page ranges (1-based, comma-separated)
Real example
document={"id":"five","pages":[p1,p2,p3,p4,p5]} (each page has width/height); ranges=1-2,5
→ plan.pageCount=3, plan.pageNumbers=[1,2,5], plan.pageIds=["p1","p2","p5"]; ranges=0 → PAGE_ZERO, 6 → PAGE_OUT_OF_BOUNDS, 5-3 → REVERSED_RANGE.
Limits and failure handling
Exactly one document; pages are 1-based, ascending and non-overlapping; real PDF page content is not read; encrypted/corrupt/empty inputs are clearly rejected; the result is not an openable PDF.
FAQ
Can I write 5,1-2?
No; ranges must be ascending and non-overlapping, so it returns OUT_OF_ORDER_RANGES.
What is the output format?
A JSON plan, mime=application/json, named pdf-split-<timestamp>.json; not a PDF file.