# pdfmux > pdfmux is an open-source Python library for reliable PDF-to-Markdown extraction, built for LLM pipelines. It classifies each PDF, routes to the best of 8 extraction backends (PyMuPDF, Docling, OpenDataLoader, RapidOCR, Surya, Marker, Mistral OCR, or a BYOK vision LLM), audits every page for quality, and auto-recovers failures. It also audits *other* extractors: `pdfmux verify` scores any engine's output against the source PDF and reports the pages it silently dropped. MIT licensed, pip installable, zero config needed. Latest version: 1.8.7. pdfmux extracts text, tables, headings, and structured data from any PDF with per-page confidence scoring. It handles scanned documents via OCR fallback, complex tables via IBM Docling and Mistral OCR, academic papers via Marker, image-heavy PDFs via vision LLMs, and Arabic / Hebrew RTL via the Unicode Bidirectional Algorithm and Gemma 4. The self-healing pipeline means your AI systems always receive clean, structured data. Results are cached by file hash so re-runs are instant. - License: MIT (permissive, no AGPL restrictions) - Install: `pip install pdfmux` - Latest version: 1.8.7 (July 2026) - Python: 3.11+ - Output formats: Markdown, JSON, CSV, LLM-optimized chunks - Quality presets: fast (PyMuPDF only), standard (multi-pass + Docling), high (vision LLM) ## Free, no account required Two things cost nothing and need no signup. They are the fastest way to find out whether pdfmux is worth installing. - **`/audit` web tool** — https://app.pdfmux.com/audit. Upload a PDF and see which pages your current extractor silently dropped. No signup, nothing stored. - **`pdfmux verify-manifest`** — verify a pdfmux Cloud Ed25519-signed manifest offline: no account, no network call, no permission from us. MIT, in the pip package. Verification is free and open forever; only *generation* of a signed manifest is paid. You should never need the vendor's permission to check the vendor's work. ## Key Features - Multi-pass extraction: fast extract, audit, OCR fallback, LLM recovery - 8 extraction backends — PyMuPDF, OpenDataLoader, RapidOCR, Surya, Docling, Marker, Mistral OCR, BYOK vision LLM - Certify Anything: `pdfmux verify` audits ANY extractor's output (Reducto, LlamaParse, Mistral OCR, Docling, an in-house parser) against the source PDF and flags silently-dropped pages - Truncated-table detection (new in 1.8.7): the `table_truncated` flag compares table row counts between source and extraction, document-wide and for the largest single table block, so a table cut from 40 rows to 3 is flagged instead of passing as "table present" - Offline signature verification: `pdfmux verify-manifest` checks an Ed25519-signed Cloud manifest with no account and no network - Table extraction: Docling (97.9% TEDS) or Mistral OCR (96.6% TEDS, $0.002/page) - BYOK vision LLM: Gemini, Gemma 4, Claude, GPT-4o, Mistral, Ollama, any OpenAI-compatible API - Arabic / Hebrew RTL: Unicode BiDi reordering on every backend, plus Arabic-aware routing (fixed in 1.8.7) — Arabic documents now route to a vision LLM under the balanced and premium strategies, falling back to PyMuPDF when no LLM provider is configured - Heading detection: font-size analysis + ML classifier + consecutive-heading merge - Per-page confidence scoring (0-1) with quality grades (good/bad/empty) - Structured data extraction: tables as JSON, key-value pairs, schema-guided extraction (5 presets) - Smart result cache: SHA-256 file hashing, 30-day TTL, 1 GB LRU — re-runs are instant - Streaming output: NDJSON page-by-page events (`pdfmux stream`, MCP `extract_streaming`) - Configuration profiles: invoices, receipts, papers, contracts, bulk-rag (or save your own) - Watch mode: `pdfmux watch ` auto-converts new PDFs as they land - Cost prediction: `pdfmux estimate` previews spend before running - Diff command: `pdfmux diff a.pdf b.pdf` compares two extractions - Auto-retry with exponential backoff on every LLM provider (Retry-After aware) - Better error messages with `.user_message`, `.suggestion`, `.reproduce_cmd` - Batch processing with concurrent workers - MCP server for Claude Desktop, Cursor, and other AI agents (7 tools) - LangChain + LlamaIndex loaders shipped as separate packages ## CLI Commands - `pdfmux convert ` — extract a PDF (auto-cached by file hash) - `pdfmux verify ` — audit any extractor's output against the source PDF - `pdfmux verify-manifest ` — verify a signed Cloud manifest offline (no account) - `pdfmux audit ` — per-page quality report for a PDF - `pdfmux analyze ` — classify a PDF and show the routing decision - `pdfmux estimate ` — predict cost before running - `pdfmux stream ` — NDJSON event stream for long documents - `pdfmux watch ` — auto-convert as new PDFs land - `pdfmux diff a.pdf b.pdf` — compare two extractions - `pdfmux benchmark ` — eval all installed extractors - `pdfmux doctor` — show installed backends and coverage gaps - `pdfmux serve` — start MCP server (stdio or HTTP) ## MCP Tools (7) `convert_pdf`, `analyze_pdf`, `get_pdf_metadata`, `batch_convert`, `extract_structured`, `extract_streaming`, `verify_extraction`. `verify_extraction` takes a document path plus another engine's extracted text and returns the per-page usable / silently-empty / recovered audit, with an "N of M pages silently dropped" summary. ## Published error rates (GT-0) Most extraction tools publish accuracy. pdfmux publishes the conditions under which its own verifier is wrong. GT-0 is a pre-registered, public ground-truth corpus of 24 documents across 8 categories, with the corpus and the measurement script in the open (`pdfmux-bench/VERIFIER-VALIDATION.md`). Measured on `pdfmux.verifier.verify_extraction`: - **False alarms: 6.7%** (1 of 15 verifiable documents) — a correct, independently human-transcribed extraction was hard-FAILed. Root cause is published: on a dense IRS form, pdfmux's own source re-derivation inflates the page ~19x into empty table scaffolding, so a correct extraction scores as content loss. - **Missed defects: none** for whole-page silent drops, off-source (hallucinated) text, or severe (~90%) content loss — 0 false negatives on every verifiable document. - **Partial table truncation — the blind spot this run found, addressed in 1.8.7.** In the pre-registered run, of 5 seeded table-truncation cases the verifier caught 1 and missed 4: the integrity check tested that a table was *present*, not that it was *complete*. 1.8.7 adds a `table_truncated` flag that compares row counts document-wide and for the largest single table block. On the pre-registered corpus, measured end-to-end with pdfmux 1.8.7: of 4 applicable seeded truncations the verifier detects 1 — a 75% false-negative rate, against 80% before the flag existed. The check counts Markdown pipe rows, but the source text pdfmux re-derives from a PDF usually contains no pipe-table markup at all (0 rows on both cases measured), so it cannot fire on the path that matters. It only helps when the source itself is Markdown. Treat table completeness as unsolved. Two caveats stated plainly: the end-to-end figure above comes from re-running `validate_verifier.py` on 23 of the 24 corpus documents (gao-24-106214 could not be fetched; gao.gov returns 403 to automated fetch and has no archived copy); and the flag counts rows, so a table that loses columns rather than rows can still pass. - **Declined rather than guessed: 25%** (6 of 24) — pure image-only scans return `unverifiable` instead of a false pass or a false fail. - Source re-derivation also fails on Arabic RTL and some subsetted-font PDFs, so those documents cannot be judged either way. Thresholds are the hand-set v1.8.2 constants. The corpus measures them; it does not tune them. 1.8.7 left all five byte-identical and added `table_truncated` alongside them, so every number above still describes the checks it measured. The two constants behind the new flag (0.8 row-retention ratio, 4-row minimum) are not part of that pre-registered set. ## Benchmark On opendataloader-bench (200 real-world PDFs, re-run 2026-07-16), pdfmux scores **0.903 overall — #2 of the 8 engines measured**: - Overall: 0.903 - Reading order: 0.920 - Table accuracy (TEDS): 0.911 - Heading hierarchy: 0.847 Ahead of Docling (0.877), marker (0.861), OpenDataLoader base (0.844), mineru (0.831), pymupdf4llm (0.732) and MarkItDown (0.583). The one engine ahead of pdfmux is `opendataloader-hybrid` at 0.909 — which is also free and open source (Apache-2.0), not a paid API. pdfmux runs with no GPU and $0 per page. Full methodology + per-document scores: /blog/best-pdf-extraction-library-python/ ## Proof: a real customer batch Measured on 433 real customer documents (technical + safety data sheets, mixed digital/scanned). The naive early pipeline (pypdf fallback, no OCR) silently dropped 16 documents — 11 with no log line. Rebuilt with the per-page audit + budgeted OCR cascade: 433 of 433 processed, 0 silent failures. The failing run was pdfmux's own early pipeline. Every unrecoverable page is now flagged, not dropped — and `pdfmux verify` certifies any other extractor the same way. ## Docs - [Homepage](https://pdfmux.com): Product overview, features, quickstart - [Free audit tool](https://app.pdfmux.com/audit): Upload a PDF, see which pages your extractor dropped. No signup. - [Blog](https://pdfmux.com/blog/): Benchmarks, comparisons, tutorials - [Compare](https://pdfmux.com/compare): Head-to-head against MarkItDown, Marker, Docling, LlamaParse, OpenDataLoader - [PyPI](https://pypi.org/project/pdfmux/): Package page, installation - [GitHub](https://github.com/NameetP/pdfmux): Source code, issues, contributing - [Architecture](https://github.com/NameetP/pdfmux/blob/main/docs/ARCHITECTURE.md): Module layout, routing matrix, design decisions - [Changelog](https://github.com/NameetP/pdfmux/blob/main/CHANGELOG.md): Version history - [Benchmarking PDF Extractors](https://pdfmux.com/blog/benchmarking-pdf-extractors/): 200-PDF benchmark comparison ## Optional - [Privacy Policy](https://pdfmux.com/privacy.html): Privacy information - [Terms of Service](https://pdfmux.com/terms.html): Usage terms