See the PDF. Use the Markdown.
A complete invoice conversion, from source document to ready-to-use output.
Contoso invoice
Headings, addresses, purchase order and totals in one response. Simple tables become Markdown; merged cells keep their HTML structure.
Table excerpt
The purchase order and line items below come directly from the full output.
| SALESPERSON | P.O. NUMBER | REQUISITIONER | SHIPPED VIA | F.O.B. POINT | TERMS |
|---|---|---|---|---|---|
| PO-3333 |
| QUANTITY | DESCRIPTION | UNIT PRICE | TOTAL |
|---|---|---|---|
| 1 | Test for 23 fields | 1 | $100.00 |
| SUBTOTAL | $100.00 | ||
| SALES TAX | $10.00 | ||
| TOTAL | $110.00 | ||
| PREVIOUS BALANCE | $500.00 | ||
| TOTAL DUE | $610.00 | ||
View the exact Markdown excerpt
invoice Markdown
| SALESPERSON | P.O. NUMBER | REQUISITIONER | SHIPPED VIA | F.O.B. POINT | TERMS |
| --- | --- | --- | --- | --- | --- |
| | PO-3333 | | | | |
<table><tr><th>QUANTITY</th><th>DESCRIPTION</th><th>UNIT PRICE</th><th>TOTAL</th></tr><tr><td>1</td><td>Test for 23 fields</td><td>1</td><td>$100.00</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td colspan="3">SUBTOTAL</td><td>$100.00</td></tr><tr><td colspan="3">SALES TAX</td><td>$10.00</td></tr><tr><td colspan="3">TOTAL</td><td>$110.00</td></tr><tr><td colspan="3">PREVIOUS BALANCE</td><td>$500.00</td></tr><tr><td colspan="3">TOTAL DUE</td><td>$610.00</td></tr></table>Mistral OCR 4.1 · September 10, 2026 · Hacker demo · Capture metadata and hashes
Convert it yourself
Bash, curl and Python 3. This script prints Markdown only after validating success.
curlDemo
#!/usr/bin/env bash
set -euo pipefail
key=demo_public_key
identity=demo-example
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
result=$work/result
status=$(curl --silent --show-error --max-time 660 -o "$result" -w '%{http_code}' \
"https://pdftomarkdown.dev/v1/convert" \
-H "Authorization: Bearer $key" -H "Idempotency-Key: $identity" \
-H "Content-Type: application/json" \
--data '{"input":{"pdf_url":"https://pdftomarkdown.dev/samples/invoice.pdf"}}')
if [ "$status" != 200 ]; then echo "HTTP $status; keep the identity for recovery" >&2; exit 1; fi
python3 - "$result" <<'PY'
import json, sys
with open(sys.argv[1]) as response:
result = json.load(response)
if not (isinstance(result, dict) and result.get("complete") is True
and isinstance(result.get("markdown"), str)
and type(result.get("pages")) is int and result["pages"] >= 0
and isinstance(result.get("request_id"), str) and result["request_id"].strip()):
sys.exit("Incomplete or invalid conversion response")
sys.stdout.write(result["markdown"])
PYOr use the CLI:
terminal
npx pdftomarkdown@0.1.6 https://pdftomarkdown.dev/samples/invoice.pdf