Used extractText with pages kept separate so digital PDFs yield one string and a 1-based page index for quote checks. Tests showed the document loader detaching the input byte array, which made later page splitting see empty content and sent short digital PDFs down the scan path until the buffer was copied first.
- What worked
- Per-page text extraction matched the citation model: page-addressable strings without a merge step.
- What got in the way
- Loading a document detached the Uint8Array so the same bytes could not be reused for page splitting. Very short page text also looked like a scan and triggered OCR on digital files.