Guides

Mistral OCR to Markdown: Preserve Tables and Image References

Plan a Mistral Document AI extraction pipeline that retains page structure, tables and image references before sending PDF content to a language model.

Key takeaway

Mistral OCR returns document content and structure; a Markdown string alone is not necessarily the complete extracted document. Preserve page associations, tables and referenced images before feeding the result into a downstream summary or retrieval system.

On this page
  1. Choose the output contract first
  2. Keep a page-level record
  3. Pick table handling deliberately
  4. Build an extraction fixture
  5. Separate extraction from interpretation
  6. Choose based on the pipeline you can maintain
  7. Save a raw response before extracting Markdown

Mistral OCR returns document content and structure; a Markdown string alone is not necessarily the complete extracted document. Preserve page associations, tables and referenced images before feeding the result into a downstream summary or retrieval system.

Mistral’s OCR processor documentation was checked November 8, 2026. We have not submitted a paid OCR job or compared extraction accuracy with another service. The workflow below specifies what to retain and verify rather than claiming a successful extraction.

Choose the output contract first

The processor guide documents PDF and image processing through mistral-ocr-latest, an alias for the current OCR model. It also describes structured extraction options. Record the requested model and date if your pipeline depends on a moving alias.

Decide what your application needs: readable Markdown, reusable tables, page-level citations, image references or all of them. A search index and an archival export have different requirements. Define the destination before discarding any response fields.

Keep a page-level record

For each page, retain its source document identity, page association and extracted content. Preserve the original response alongside transformed Markdown so a later parsing error can be traced back to the OCR output.

Artifact Why retain it?
Original PDF Visual ground truth for checks
Raw OCR response Evidence before your cleanup code runs
Page-associated Markdown Traceable retrieval and reading order
Table and image assets Content a plain text export can lose
Transformation log Distinguishes OCR errors from your own changes

Do not rename image files independently of the references pointing to them. A Markdown page that opens correctly in one temporary folder may break when moved to your site or document store.

Pick table handling deliberately

The documentation supports table_format values of null, markdown and html. Inline tables and separately returned tables serve different integration needs. Choose an output representation your downstream tool can actually preserve, rather than assuming every table is plain prose.

Headers and footers can also be extracted separately through documented options. Block extraction is version-dependent, so verify the relevant model requirements before relying on block labels or bounding boxes. A request copied from a newer example may not match an older pinned model.

Build an extraction fixture

Create a short PDF containing a two-column page, a table with merged headings, a footnote and an image caption. Write a reference sheet describing the expected reading order and the relationship between each asset and its caption.

After extraction, inspect the rendered source beside the output. Check whether negative numbers retained their signs, table headers stayed attached to the right columns and footnotes were mistaken for main text. These are suggested checks; no result is implied here.

Separate extraction from interpretation

Only after the structure passes inspection should you ask another model to summarize the document. Keep the source page with each chunk so a generated claim can be traced back to the original.

For example, a summary saying that revenue rose is unreliable if OCR moved a column from a different year into the current row. Rephrasing the summary prompt will not repair that underlying evidence problem.

Our RAGFlow parsing guide discusses the same downstream principle in a different system. This article focuses on Mistral’s hosted OCR response and export contract; the MinerU guide retains the separate local conversion route.

Choose based on the pipeline you can maintain

Use the documented processor when its service route and response format fit your application. Before adopting it broadly, verify current pricing, data handling and account eligibility for your own workload. We do not infer those terms from the OCR model’s capabilities or from an old launch announcement.

Save a raw response before extracting Markdown

For the current Python client example in the processor documentation, install mistralai in a virtual environment. The following script accepts a public PDF URL, requests OCR, saves the raw response and writes one Markdown file per returned page. It can incur API charges. We have checked the Python syntax only; no OCR job was executed.

import getpass
import json
from pathlib import Path
from mistralai.client import Mistral

url = input("Public URL of a PDF you may process: ").strip()
if not url.startswith("https://"):
    raise SystemExit("Supply a public HTTPS PDF URL.")
out = Path(input("New output directory: ").strip())
out.mkdir(parents=True, exist_ok=False)
client = Mistral(api_key=getpass.getpass("Mistral API key: "))
reply = client.ocr.process(
    model="mistral-ocr-latest",
    document={"type": "document_url", "document_url": url},
    table_format="html",
    include_image_base64=True,
)
raw = reply.model_dump(mode="json")
(out / "response.json").write_text(json.dumps(raw, indent=2), encoding="utf-8")
for ordinal, page in enumerate(raw.get("pages", []), start=1):
    (out / f"page-{ordinal:04d}.md").write_text(
        page.get("markdown", ""), encoding="utf-8"
    )
print("Saved", len(raw.get("pages", [])), "page records; inspect response.json too.")

The Markdown files are an inspection aid, not a complete portable export: separately returned tables and Base64 image content remain in response.json. Keep that file and inspect the response structure before building an asset exporter. An empty pages list is not evidence of a successfully extracted document.

Sources & references

Written by Modelrovia Editorial. Our standards distinguish official claims from observed results.

How we research and test →

Tools in this article