There is a tempting shortcut in every document pipeline: if the PDF already contains a text layer, just read it. It is instant, free, and exact. No model, no inference cost, no hallucination risk.

Often that is the right call. But the text layer of a PDF is a claim about what the page says, not a guarantee, and there are several common situations where the claim is wrong. Knowing which is which is worth doing deliberately rather than by assumption.

What a text layer actually is

A PDF is a drawing program. It contains instructions to place glyphs at coordinates. The "text" you can select is a byproduct of those instructions plus a font encoding map that says which character each glyph represents.

Nothing enforces that the map is correct, that the reading order matches visual order, or that the text corresponds to what a human sees. All three assumptions break in practice.

Where the text layer misleads

Broken encodings. Subset-embedded fonts with a missing or wrong ToUnicode map produce selectable text that is complete gibberish, or — worse — plausible-looking text with systematic substitutions. Documents generated by older typesetting systems and some regional-script producers are frequent offenders. Copy text out of the PDF and paste it into a plain editor: if it looks wrong there, your pipeline is ingesting that.

Reading order. The text layer is in drawing order, which is not necessarily reading order. Multi-column layouts, sidebars, tables and footnotes routinely interleave. A two-column page can yield alternating lines from both columns, producing text that is individually correct and collectively meaningless.

Invisible text. Scanned documents are often shipped with an OCR text layer rendered invisibly behind the image. That layer inherits every error the original OCR made — including on handwriting, where those errors are severe. The document looks like a digital-native PDF and is in fact a scan with a low-quality transcript attached.

Text that is not visually present. Watermarks, template boilerplate from a form generator, content hidden under a redaction rectangle that was drawn rather than applied. That last one is a genuine data-leak vector: a black rectangle over a name does not remove the name from the text layer.

Values rendered as vectors or images. Signatures, stamps, checkbox marks, and sometimes numeric fields drawn as graphics. These are simply absent from the text layer, so a checkbox-driven decision silently reads as unset.

Form field values versus rendered values. An AcroForm's field values and what is drawn on the page can diverge, particularly after flattening or programmatic edits. Extracting from the wrong one gives stale data.

A practical triage

Rather than choosing one strategy for the whole corpus, classify each file on ingest:

  1. Is there a text layer at all? No text, or text on only some pages, means vision extraction for the pages without.
  2. Is the text plausible? Cheap heuristics catch most encoding failures: dictionary hit rate against expected languages, ratio of replacement characters, proportion of alphabetic characters, presence of expected keywords for the document type.
  3. Is it a scan with an OCR layer? A full-page image plus a text layer is the signature. Check for large images covering the page area and for text with no font resources of its own.
  4. Does reading order look sane? Compare text-layer order against the geometric ordering of the glyph positions. Large disagreement means reconstruct from coordinates rather than trusting the stream.
  5. Does the document contain tables or checkboxes? If the fields you need are structural, plan on geometry regardless of text quality.

Files passing all checks can go the fast, free path. Everything else goes to vision extraction. In most real corpora this splits the volume favourably and keeps cost down without accepting silent corruption.

The hybrid that works best

Where both signals are available, use both. Extract with the vision model, and use the text layer as an independent verification source: if the model returns a value and that exact string appears in the text layer at the expected coordinates, you have two independent confirmations and can auto-approve with high confidence. Where they disagree, you have a specific, localised flag for review.

This is a much better use of the text layer than treating it as the primary source. It converts a sometimes-unreliable input into a reliable checker, which is a role it performs well because its failure modes are largely uncorrelated with the model's.

Practical notes

  • Always keep the page image. Even for digital-native PDFs. Review tooling needs to show a human what the page looks like, and you cannot reconstruct that from the text stream. Rendering pages at ingest and storing them is worth the storage.
  • Preserve coordinates. Text without geometry cannot be verified, cropped for review, or reassembled into tables.
  • Never treat the text layer as evidence of redaction. If you handle documents where content is meant to be removed, redaction has to be applied to the content stream and verified independently.
  • Watch for password-protected and permission-restricted files. These often arrive from external counterparties and will fail silently in a naive ingestion path.
  • Log which path each document took. When an accuracy problem appears, the first useful question is whether the affected documents came through the fast path or the vision path.

The summary

A PDF text layer is a helpful hint with excellent economics and no guarantee of truth. Use it where it verifies, use it where you have checked it, and never use it as the sole source for a field that matters without knowing which category the file falls into. The cost of the classification step is trivial; the cost of discovering six months later that one counterparty's documents have had a broken encoding the whole time is not.

Not sure which of your PDFs are lying to you?

We will profile a sample of your corpus and tell you which files have trustworthy text layers and which need vision extraction.

Book a Demo