Page routing
Per-page extraction routing
Choosing an extraction method separately for each page: keep the text layer, run OCR, or send the page to a vision model, based on what that page needs.
In DocSlurpGlossary entry
On this page
Page routing chooses how to extract each page of a document separately, instead of running one method on the whole file.
The options form a cost ladder:
| Route | When it fits | Relative cost |
|---|---|---|
| Keep the text layer | born-digital text with mapped glyphs | almost free |
| OCR | scanned page of plain text | low, local CPU |
| Vision-language model | tables, charts, math, handwriting, messy scans | high, model call |
| Skip | blank page | free |
A 40-page board-update-2026.pdf might be 36 pages of clean digital text, two scanned appendix pages, one page with a dense table and one blank separator. Sending all 40 to a vision model costs 40 model calls. Routing keeps the text layer for the 36, runs OCR on the two scans, sends the table page to a vision model and skips the blank one: one model call instead of 40. The output is as good or better, because the text layer for those 36 pages is exact.
A router needs cheap signals for every page before deciding: does it have a text layer, do its glyphs map to real characters, how much of the page is covered by images, does it contain math symbols or ruled table lines? The expensive reader is called only where those signals say the cheap one will fail.
The gotcha: a router’s mistakes are silent. A page wrongly sent down the cheap path produces plausible but wrong text, such as columns read straight across, and nothing downstream flags it. Run new routing rules in shadow mode first, logging what they would have chosen, and compare against a stronger reader on a sample before acting on them. See pages per $1.
In DocSlurp
In DocSlurp
By default classify-route authorizes OCR only for pages with no native text whose images hold the content, and fast never reads pages (core/worker/src/stages/classify-route.ts). An opt-in page router (pageRouter.mode: off, shadow or active) probes each page and plans roles such as accept-text, ocr, table and math (core/worker/src/routing/planner.ts).