New Tool Radar

AI PDF

How to Extract Structured Text from a Scanned PDF with Mistral OCR

Extract structured text, tables and bounding boxes from a scanned PDF with the Mistral OCR API.

Schematic illustration of Mistral OCR: send the scanned PDF to the API, read the markdown output, and check the total and bounding boxes.

Mistral OCR is a document-understanding model, not just a text reader: it returns markdown, tables, bounding boxes and per-word confidence scores. Mistral OCR 4, announced in 2026, adds typed-block classification and supports 170 languages. This guide runs it on one scanned invoice and checks the result.

Prerequisites

A Mistral API key, a scanned PDF, and Python with the mistralai package. Keep the API key out of shared files and delete uploads you no longer need.

Steps

1. Send the scanned PDF to Mistral OCR

Call the OCR endpoint with the PDF file and the mistral-ocr-latest model. Expected result: a response with a pages array is returned.

2. Read the markdown for the first page

Read the markdown field for page 1. Expected result: the invoice lines appear as structured markdown text.

3. Check the invoice total in the response

Find the invoice total in the extracted markdown. Expected result: the total reads 486.00.

4. Check a bounding box for one field

Find the bounding box for the invoice number in the response. Expected result: the box coordinates sit over the invoice number on the page.

Practice check: fictional scanned invoice INV-2204, four lines

The table below is fictional practice material. It lists the four checks for the Mistral OCR response.

Check Expected result
Response returned Pages array present
Markdown on page 1 Four invoice lines
Invoice total 486.00
Bounding box Over the invoice number

Expected result. the response returns a pages array, the markdown lists the four invoice lines, the total reads 486.00, and the invoice number has a bounding box.

Limits

  • Mistral OCR is a hosted API, so the document leaves your machine; do not send contracts or personal papers you cannot share, and always verify money figures against the scan.
  • UNTESTED – no OCR tool or AI tool was run; all results above are expected results. The practice file is fictional.

Sources

See all