Compass Docs
WorkflowsComponents

Document Parser

The Document Parser component — read a document's text from PDF, Word, Excel, or text files, using OCR for scanned pages.

The Document Parser reads a document and returns its text. Word headings and tables, Excel sheets, and pages read with OCR come back as Markdown, keeping their structure; a PDF's text layer comes back as plain text. Give it a file and hand the text to an agent, a Prompt, or an Embeddings step. It's the same reader datasets use.

What it reads

FileHow it's read
PDFPage by page from the text layer. Pages that are only images — scans — need OCR.
Word (.docx)Headings and tables are kept.
Excel (.xlsx)Each sheet becomes a heading and a table, with calculated values.
TextMarkdown, CSV, and plain text are read as they are.
ImagesOnly with an OCR connection.

Anything else fails the step, naming the file.

Inputs

  • document — the file to read, bound from the Input or an earlier step. It can also be a list of files — see below.
  • OCR — optional. Pick a connection with the OCR capability, such as Azure Document Intelligence, to read scanned pages.

Settings

SettingDefaultWhat it does
Always use OCROffRead every page with OCR, not just the ones with no text layer. Better tables and reading order — and a charge for every page.
Allow image-only pagesOffWhen a PDF has scanned pages and there's no OCR connection, return what text there is instead of failing.
Parallel files5How many files to read at once, when the input is a list.

Scanned documents

With an OCR connection, only the pages that need it go to OCR (unless Always use OCR is on). Without one, a document with scanned pages fails, and the error names the pages — "Pages 3, 5 of 'statement.pdf' are images, not text." That's on purpose: a partly-read document is usually worse than an error, because nothing downstream can tell what's missing. Turn on Allow image-only pages only where that gap is acceptable.

Reading many files

Bind document to a list of files — the pages from a Document Splitter, say — and the parser reads every one, Parallel files at a time, and returns a list of their text in the same order.

Input (file) → Document Splitter → Document Parser → Agent → Output

As a tool

The Document Parser can be an agent's tool, so the agent can read a file when it decides to. As a tool it has no OCR connection, so scanned pages fail — use it as a step when you need OCR.

Next

On this page