SuperAPIAI Directory

pdfmux

github.com · AI developer platforms

PDF extraction router that classifies each page and routes it to PyMuPDF, Docling, OCR or an LLM fallback, re-extracting pages with low confidence scores.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

pdfmux is a self-healing PDF extraction tool that audits its own output and can certify the output of any other extraction engine, identifying pages they silently drop. The tool is free, MIT-licensed, requires no account, and is installed with the command pip install pdfmux.

Purpose

pdfmux is aimed primarily at scenarios that need to extract clean data from PDFs for LLM or RAG pipelines. It is not yet another PDF extractor, but an orchestration layer: it selects the most suitable extractor per page, validates the results, and retries failed pages. The core problem it solves is that many extractors silently drop content when they encounter pages they cannot handle, resulting in no errors in the logs but missing data, thereby polluting the RAG index. Through self-auditing and certification, pdfmux explicitly flags these silently dropped pages.

Key Capabilities

  1. Self-healing extraction: classifies each page (text, tables, images, formulas, headings), then routes it to one of 7 built-in extraction backends (including PyMuPDF, RapidOCR, Docling, vision LLMs, etc.), with support for bring-your-own-key (BYOK) LLM fallback (Gemini, Claude, GPT-4o, Ollama). After extraction, it uses a 4-signal confidence score (character density, OCR noise ratio, table completeness, heading structure) to re-extract low-confidence pages and flag pages that still cannot be read.
  2. Certify Anything (new in v1.8.1): pdfmux verify can audit the output of any extraction engine (such as Reducto, Mistral OCR, LlamaParse, Docling, or a custom parser) against the source PDF to identify silently dropped pages. It re-derives the source text through pdfmux's own auditing process, aligns the extraction results, and scores each page, outputting PASS/REVIEW/FAIL verdicts, overall confidence, and coverage.
  3. Multi-format support: supports text extraction, structured extraction, schema-guided extraction, and streaming extraction (memory-constrained), and handles RTL languages such as Arabic, Persian, Urdu, and Hebrew, automatically adjusting reading order via the Unicode bidirectional algorithm.
  4. Smart caching: computes SHA-256 for each input PDF, caches results keyed by (file_hash, quality, format, schema),Repeated extraction completes instantly, with cache located at ~/.cache/pdfmux/results/, expiring after 30 days, with 1 GB LRU eviction.
  5. MCP server: provides an MCP server with 7 tools that can integrate with AI agents (such as Claude Desktop), including convert_pdf, analyze_pdf, extract_structured, extract_streaming, get_pdf_metadata, batch_convert, and verify_extraction.
  6. Other features: pdfmux benchmark, pdfmux estimate (estimates cost and backend), NDJSON event stream, directory auto-conversion, side-by-side extraction comparison, configuration file (~/.config/pdfmux/profiles.yaml), etc.

Usage

Installation: pip install pdfmux (when processing scanned documents, additionally install pip install pdfmux[ocr]). Requires Python 3.11+. Basic usage is done via CLI or API. Batch processing should use batch_extract() rather than a subprocess loop. BYOK LLM configuration is done with 5 lines of YAML, supports multiple providers, and all retry logic is handled automatically (429 follows Retry-After, authentication failures fail fast). The MCP server can be started with one line of configuration or Claude Code. Verification feature: pdfmux verify accepts extraction results in JSON, Markdown, or plain text format (--extracted-format auto|json|markdown|text), compares page by page when the extraction results have a per-page structure, otherwise falls back to a content existence check. Each manifest includes a SHA-256 content signature and an honest list of limitations (the verifier is lexical, not linguistic, detecting missing and garbled content, not faithful rewrites or translations).

Applicable scenarios

  • RAG pipelines: ensure the data fed into the LLM is clean, complete, and has no silently dropped pages.
  • Document processing batch tasks: process mixed digital and scanned PDF collections, with automatic routing and auditing.
  • Scenarios that need to verify the output of third-party extraction engines: verify Reducto, Mistral OCR, LlamaParse, and other tools for whether they silently drop pages.
  • AI agent integration: through the MCP server, let agents verify engine output at the same time as extraction.
  • Multilingual documents: especially extraction of documents in RTL languages such as Arabic.

Limitations

  • The verification feature is lexical rather than linguistic: it detects missing and garbled content, not faithful rewrites or translations.
  • A local installation can audit extraction, but cannot attest extraction; signatures can be forged. The attestation feature requiring Ed25519-signed manifests belongs to pdfmux Cloud (generation costs $49/month, verification is permanently free).
  • The confidence-budgeted decision tracing method (persisting per-page decision traces, retaining rejected candidates, monotonic repair protection) is patent pending (U.S. Provisional Application No. 64/106,302) and is reserved for pdfmux Cloud/Pro commercial licensing, not covered by the MIT license.
  • There is no need to use pypdf/pdfplumber as a fallback, because pdfmux already routes by page, PyMuPDF can tolerate malformed PDFs that pypdf rejects, and a downstream pypdf fallback would instead turn recoverable PDFs into failures.
  • Some features (such as visual LLM extraction of Arabic pages, aggressive normalization) need to be explicitly enabled.

Other facts

  • Scored 0.903 on opendataloader-bench (200 real PDFs), ranking 2nd among 8 engines (second only to opendataloader-hybrid's 0.909, rerun date 2026-07-16).
  • Real customer batch test: 433 documents, using the rebuilt version with per-page auditing and budgeted OCR cascading, 433/433 processed successfully, zero silent failures.
  • License: the pdfmux library and MCP server in this repository are licensed under MIT, free for any use, and all released versions remain MIT.
  • Project address:https://github.com/NameetP/pdfmux
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools