# Reading text out of a document

Extraction pulls the words a document actually stores. A PDF exported from an application carries a text layer and gives it up exactly; a DOCX gives its body; a PPTX gives what is on the slides; TXT, Markdown and JSON are already words. A scanned PDF stores pictures of words and has no layer to extract, so the model reads the pages instead.

- **Status:** Available
- **Audience:** both
- **In the app:** #/data
- **Last verified:** 2026-09-10
- **Canonical:** https://connectbyjbrh.com/docs/files-data/text-extraction/

## What extraction is, and what it is not

Extraction is retrieval, not interpretation. The reader for a format asks the document for the characters it holds and gets them back unchanged. Nothing is summarised, corrected or completed at this stage — a typo in your document is a typo in the extraction, which is the correct behaviour for something a quotation might later be drawn from.

That distinction is the reason the difference between a text layer and a picture of words matters so much. Where a layer exists, what comes out is what the author wrote. Where it does not, what comes out is a model's reading of an image, which is often right and is never a transcription.

## Reading order, and where it goes wrong

A document stores characters in some order, and that order is what extraction returns. For a straightforward page it is the order you would read in. For a page with columns, sidebars, headers or a text box floating over the body, the stored order and the visual order can differ — and extraction follows the stored one, because that is the only order that exists in the file.

**Two columns** — May interleave, left line then right line, if the document stores them that way.
**A header or footer on every page** — May appear repeatedly through the extracted content, because it genuinely appears repeatedly in the file.
**A pull quote or text box** — May land somewhere unrelated to where it looks on the page.
**A table inside a document** — Comes out as words in sequence, not as rows and columns — for those, [reading tables out of a file](/docs/files-data/table-extraction/) is the right page.

> **Note** None of these are faults to report; they are properties of the document. If reading order matters for a particular file, the [preview](/docs/files-data/preview/) shows you the order that was obtained before you rely on an answer built from it.

## When there is no layer

1. Try selecting words in the document in your own PDF viewer.
   - Result: If you can select them, a layer exists and extraction is exact. If your cursor draws a box instead, the page is an image.
2. Upload it anyway if that is what you have.
   - Result: The model reads the rendered pages and can answer questions about them. What it cannot do is quote a string it never received as characters.
3. For anything where a digit or a name must be exact, get the source instead.
   - Result: A spreadsheet, an exported PDF, or the original document removes the reading step entirely.
4. If the source is genuinely unavailable, verify the specific value yourself before acting on it.
   - Result: Reading an amount off a photograph is exactly the task where a single wrong character is both plausible and expensive.

[The PDF has no readable text](/docs/troubleshooting/pdf-no-text/) covers the symptom in the form people usually meet it: an answer that is vague about a document they can read perfectly well themselves.

## What reaches the model

Extraction and grounding are separate steps. Everything extracted is stored against the version; what is handed to a model when you ask a question is bounded by the grounding budget, which is a few thousand characters rather than a whole book. The relevant part is selected for the question you asked.

This is why a narrow question outperforms a broad one on a long document. 'What notice period does clause 12 give?' selects a passage. 'Summarise this' asks a bounded excerpt to stand for the whole, and the answer is only as complete as the excerpt was.

> **Careful** Words inside a document are content, never instruction. A file containing a sentence addressed to Connect is reported as something the document says, not acted on — the same rule that applies to a message arriving by email.

## Questions

### Are tracked changes and comments extracted from a DOCX?

The body is what extraction takes. Tracked changes and comments are not the body, so accept or reject them and resolve the comments before uploading if their content matters.

### Does extraction happen again when I ask a second question?

No. It happens once, against that version of the file, and later questions read what was extracted. A new version is extracted separately, which is why an answer about a file is an answer about one version of it.

### Can I get the whole extracted content back out?

You can see what was obtained in the preview. What a model is given for any one question is bounded by the grounding budget, so asking it to reproduce a long document returns a portion rather than the whole.

## Related

- [File formats Connect reads](https://connectbyjbrh.com/docs/files-data/supported-formats/)
- [Previewing a file](https://connectbyjbrh.com/docs/files-data/preview/)
- [Reading tables out of a file](https://connectbyjbrh.com/docs/files-data/table-extraction/)
- [The PDF has no readable text](https://connectbyjbrh.com/docs/troubleshooting/pdf-no-text/)
- [Grounding an answer without pretending to have a vector database](https://connectbyjbrh.com/research/grounding-without-a-vector-database/)

## What this page is based on

- `docs-source/sources/GENERAL.md` §9 — PDF text layer else the model reads it; DOCX, PPTX, TXT, MD, JSON
- Connect capability registry (docs-source/facts.py) — `file_workspace`, MEASURED knowledge budgets
- `backend/app/file_formats.py` — the per-format readers
