A scanned PDF page can contain an embedded page number and still have no selectable body text. A file-level check sees text somewhere in the document, skips OCR, and sends an almost empty page to the index. The missing page may look like a retrieval problem later, even though the words never entered the index.
A page-by-page audit is a useful first step when converting mixed technical documents with KolmoPDF's PDF-to-Markdown tool. Start with an authorized sample containing both selectable and scanned pages. Compare each source page with the Markdown output, particularly pages that contain diagrams, tables, or very little extracted text. The example below is a synthetic fixture for designing that check; it is not a claim about any particular conversion result.
Build a fixture that defeats the empty-page check
Imagine a three-page document:
- Page 1 has selectable paragraphs and a page number.
- Page 2 is a scanned paragraph with an embedded page number,
2. - Page 3 is a diagram with a short caption and no paragraph text.
A rule that marks every nonempty extraction as successful accepts page 2. A rule that sends every short page to OCR also catches page 3, even though a short caption may be the complete textual content. A character threshold can help find candidates for review, but it cannot establish whether a page is complete.
For an audit, retain a record for each page with a source identifier, its physical page index, extraction route if known, and a reference to the rendered page. Keep the original extracted text beside the normalized text used for retrieval. If a service returns one Markdown file without page-level route metadata, record the route as unknown; do not infer it from the text alone. Page boundaries must come from reliable converter output or a separate mapping process.
Compare coverage at page level
This small Python example flags pages for inspection. It treats page numbers as possible noise and leaves a short page in the review queue instead of declaring it empty. The inputs are illustrative strings, not a PDF parser.
import re
pages = [
{"page": 1, "text": "Introduction to the measurement protocol."},
{"page": 2, "text": "2"},
{"page": 3, "text": "Figure 1. Sensor layout."},
]
def needs_review(text, minimum_chars=30):
lines = [line.strip() for line in text.splitlines() if line.strip()]
body = " ".join(line for line in lines if not re.fullmatch(r"\d+", line))
return len(body) < minimum_chars
for page in pages:
if needs_review(page["text"]):
print(f"Review page {page['page']}")
This prints pages 2 and 3. A reviewer can confirm that page 2 needs another extraction route and that page 3's caption is complete. The threshold is a starting point to tune on your own documents. A blank page, a title page, and a page full of formulas will need different handling. Removing number-only lines is a heuristic too: a meaningful standalone number could be lost, so keep the original text.
When the text is sparse, inspect the page image before replacing anything. If the original has text that the Markdown omits, try an OCR-capable route and compare the new result against the source. For a page with a table, check row and column associations as well as the words and numbers. Keep both outputs and their page references until the discrepancy is resolved.
Keep the retrieval test separate
After checking extraction, create a question whose answer appears only on the scanned page. Verify that the expected page appears in retrieval and that the answer cites it. An extraction pass cannot guarantee retrieval will succeed: chunking, indexing, and ranking can each lose the evidence later.
Include a negative question about information absent from the controlled sample. That checks whether the answerer invents an answer from nearby text. For documents with right-to-left text or multiple columns, add a short expected sequence of words or paragraphs to the fixture. A page can contain all its words and still present them in a misleading order.
Before uploading a document for online processing, confirm that its contents are authorized for that service. For sensitive files, use an approved processing arrangement. Save the reviewed source pages and expected outputs as regression fixtures, so a converter or indexing change can be checked against the same examples.
Top comments (2)
The fixture with page 2 containing only the embedded "2" is a perfect trap for a file-level "this PDF has text, skip OCR" rule. I have seen the same failure show up later as a retrieval miss, when the words simply never entered the index. Treating a short page as a review candidate rather than as empty is the right default, especially because a caption-only diagram page can be complete. The part I would not skip is the retrieval test you describe at the end: after extraction looks healthy, ask a question whose answer lives only on the scanned page, and fail the index if that page is absent. I would also keep the extraction route (text layer vs OCR vs unknown) on each page record, so a later re-index cannot silently re-apply the file-level shortcut.
This is the right trap to build, and the detail that makes it bite is the threshold: a page whose only extracted text is the folio "2" passes every file-level check, so the check has to happen per page, after stripping running headers, footers and page numbers, and it has to count what is left. In practice I treat a page as thin when, once the folio and repeated header/footer lines are removed, fewer than a handful of real words remain — and a thin page is routed to OCR rather than trusted as empty. That is exactly the rule in pdf-slice (github.com/kamalmosadegh/pdf-slice): per-page provenance — text layer or OCR — recorded alongside the output, so a page never silently becomes "no content".
One addition to your retrieval test: ask the scanned-page question and require the answer to cite its page. If the answer comes back from a neighbouring page, or with no citation at all, the page was indexed as empty and the model is filling the gap from elsewhere — which is the failure your fixture is designed to catch, just one step downstream. I measured the same silent-empty failure with MarkItDown on a scanned PDF in dev.to/kamalmosadegh/markitdown-re... — the file-level output looked complete, and only the per-page count showed the missing pages.