> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/files-knowledge-and-retrieval/parsing-ocr-and-document-structure.md).

# Parsing, OCR, and Document Structure

Parsing extracts usable content from a file. OCR can recover text from scanned pages or images. Choose settings that preserve the content needed by the workflow.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2Fm3Ojdz3X7SNQyjyP9kZL%2FG039.mp4?alt=media&token=4b4833ff-28d9-4cfb-9fa9-8d1d4a3f7fdf>" %}

## Before you begin

A supported source file and access to the available parser or OCR settings.

## Key concepts

| Term           | Definition                                                                                                                                    |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Parsing        | Extraction of usable text or structure from source content. Review the extracted content when the workflow misses text, tables, or locations. |
| OCR            | Optical character recognition, which extracts text from images or scanned pages. Image quality and layout affect recognition accuracy.        |
| Parsed text    | The extracted representation of a file used by later processing. It can omit visual layout even when the original file displays correctly.    |
| Source locator | A supported position within a document, such as a page or passage reference. Do not invent a locator when parsing did not return one.         |

## Check document parsing

1. Inspect whether the document contains selectable text, scans, tables, or embedded files.
2. Choose the appropriate parsing and OCR settings.

![Open Update Settings before ingestion and review the available processing controls.](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/5fgOG9YDCIEi9xbGDVIY/assets/g039-g039-01-settings.png)

Open Update Settings before ingestion and review the available processing controls.

3. Review the extracted text and source locations before relying on retrieval or generation.

The parsed content contains the relevant text and structure from the source.

## Behavior and limitations

PDF and Office behavior can depend on parser options and enabled capabilities. Some provider files are exported to another format before parsing. Archives and embedded documents can create child processing work. Upload success does not establish that tables, page locations, or scanned text were extracted correctly.

## Related resources

[Chunking, OCR, and embedding settings](https://docs.stackai.com/guides-and-quickstarts/knowledge-and-retrieval/chunking-ocr-and-embedding-settings.md)

[File Inputs, Supported Formats, and Size Limits](https://docs.stackai.com/technical-reference/files-knowledge-and-retrieval/file-inputs-supported-formats-and-size-limits.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/technical-reference/files-knowledge-and-retrieval/parsing-ocr-and-document-structure.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
