Selecting pages & capping large PDFs
OCR and extraction cost scale with pages. You rarely need every page of a long PDF, so the platform lets you select pages per document and cap large PDFs across a whole batch.
Single document
Section titled “Single document”On New document (/documents/new) the Pages control offers:
- All pages — the default.
- First N pages —
1-N. - First N pages + last page —
1-N,last. Thelasttoken resolves to the document’s final page server-side, so you don’t need to know the page count. - Custom — a print-style spec like
1-3, 5, 12-14, last.
The selection becomes the page_range form field on POST /v1/documents.
The PDF page limit applies to the selected count, so a range pulls a few
pages out of a very large PDF. Original page numbers are preserved on the
result (canonical.pages[].source_page_number).
A whole batch
Section titled “A whole batch”On New batch (/batches/new) Page handling applies to every file:
- All pages.
- Cap large PDFs — first N pages + last page, for PDFs over M pages.
Each file is expanded individually from its own page count: a 400-page PDF
becomes
1-N,last; a 12-page PDF runs in full. This is the one-control way to keep a heterogeneous batch cheap — set it once and submit. - Same page range for every file (uploads only) — one print-style spec applied uniformly.
Cap large PDFs sends a page_cap_policy
({over_pages, first_pages, include_last}); the uniform range sends
page_range. They are mutually exclusive. The cap policy also applies to
source-pull batches — it is expanded as each remote file is discovered.
The page_range DSL
Section titled “The page_range DSL”page_range is comma-separated, 1-indexed, case-insensitive:
| Spec | Pages |
|---|---|
all / empty / omitted | every page |
1-3,5,12-14 | 1,2,3,5,12,13,14 |
last | the final page |
1-10,last | first 10 + the last page |
A spec that lands entirely outside the document is a 400; a spec that partly overshoots is clamped, the way a printer would.