← Back to Leaderboard
Ppymupdf

pymupdf/PyMuPDF

MuPDF-backed Python engine for layout-aware document ingestion and page grounding

Engineering Health (Methodology)
A · 84/100
Maintenance Activity
● Updated today
Latest Release
2.2
Commercial License Check
AGPL-3.0 · Copyleft Warning

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption18/25
Release Cadence20/20
License Clarity11/20
Self-HostedAPI
Total Stars
★ 11,245
24h Growth
+3
7d Growth
+38
Forks
860

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

pymupdf/PyMuPDF Star History (2020-01-12 - 2026-12-04) ALL-TIME STAR HISTORY (2020-01 – 2026-12) +10.8k in 2518d · avg +4/day 11.9k 5.9k 0 2020-01-12: ★ 4172020-06-13: ★ 5452020-11-14: ★ 6892021-04-17: ★ 8722021-09-18: ★ 1,0852022-02-19: ★ 1,3312022-07-23: ★ 1,5942022-12-24: ★ 1,8462023-05-27: ★ 2,4172023-10-28: ★ 2,9702024-03-30: ★ 3,7632024-08-31: ★ 4,8622025-02-01: ★ 6,2102025-07-05: ★ 7,4032025-12-06: ★ 8,5152026-05-09: ★ 9,5612026-12-04: ★ 11,245 ★ 11.2k 2020-01 2023-06 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

PyMuPDF is an ingestion component for RAG, not a database or retrieval service. Its Python API calls the MuPDF C engine in-process: pymupdf.open() yields a document, and page objects expose text, tables, images, and rendering. page.get_text("dict") returns blocks, lines, and spans with geometry and styling. A pipeline can retain page identifiers and bounding boxes alongside chunks so a later citation can point back to the source.

The 2.x document-level API adds layout-aware Markdown, JSON, and plain text. Certain ML layout features use ONNX Runtime and can run on CPU. OCR is a separate path for image-only pages or broken text mappings. Office ingestion extends the same document interface through pymupdf-office, rather than requiring an Office application or LibreOffice subprocess. For packaging, pyproject.toml declares pipcl as a build requirement and a local setup backend; that build configuration is distinct from runtime dependencies such as ONNX Runtime for applicable layout features.

Key Capabilities & Differentiators

For PDFs, the core can extract text with position and style metadata, find tables and export them to Markdown or pandas, and render pages to a Pixmap at a chosen DPI. Embedded raster images can be extracted separately, but vector-only charts must be rendered to capture their appearance. The same library handles annotations, applied redactions, AcroForm fields, page reordering, merging, and splitting.

The input surface also includes XPS, EPUB, SVG, Markdown, and common raster formats. The licensed Office extension adds Word, Excel, PowerPoint, HWP, and HWPX inputs. Layout-aware output supports multi-column reading order and page chunking. On ExtractBench’s 370 PDFs, RapidOCR scored 85.20% overall versus Tesseract’s 78.31%, but Tesseract led 30.49% to 29.22% on the 20 documents over 50 pages. That reversal makes a corpus-specific OCR trial more useful than a blanket backend choice.

Trade-offs & Limitations

Compared with a pure-Python text extractor, PyMuPDF is a stronger fit when one pipeline needs page rendering, table extraction, edits, and source coordinates. If clean text is the only deliverable, a narrower parser may be easier to package on targets without compatible wheels. Local processing avoids a cloud OCR round trip and keeps source files inside the deployment boundary, but operators must provision OCR dependencies and absorb the CPU and memory cost of high-DPI rendering and concurrent scans.

Native extraction is not reliable for image-only PDFs or fonts without usable Unicode mappings, so budget for selective OCR and validate reading order and table boundaries on representative documents. Source-page metadata helps reviewers check an answer; it does not ensure that a retriever or LLM cites the right evidence. Assess AGPL-3.0 obligations against your distribution and network-service model, or evaluate commercial terms. The separate Office extension’s keyless evaluation is time-limited and exposes only the first three pages per document.

Hardware & Deployment Guide

Install with python -m pip install --upgrade pymupdf and use import pymupdf. The 2.x platform matrix lists Python 3.11–3.15 and wheels for supported Windows, macOS, manylinux, and musllinux targets; source installation needs a C/C++ toolchain. Run pymupdf-config to inspect the installation. Provision ONNX Runtime compatibility for layout features, Tesseract and language data or RapidOCR for scans, and a separately licensed Office extension if needed.

Self-hosting means embedding the Python API in your own process or worker, not deploying a bundled HTTP service. Stage the required packages and OCR assets ahead of time for an offline environment. Establish CPU, peak memory, and timeout budgets on a mixed batch of native PDFs, scans, and large pages before setting concurrency. Version 2.0 marks the layout-aware extraction milestone; the 2.1 and 2.2 release entries primarily list fixes. Pin and regression-test the version used for production ingestion.

Runtime: In-process Python API backed by MuPDF’s native C engine, with a CPU execution path.
Provenance: Structured text spans expose font, size, color, and bounding boxes for page-level verification.
RAG output: Document-level Markdown, JSON, and plain text, with support for multi-column reading order and page chunking.
Tables and graphics: find_tables() exports Markdown or pandas DataFrames; get_pixmap() renders vector artwork that raster-image extraction misses.
OCR: Partial or full-page Tesseract OCR with configurable language; RapidOCR is an optional alternative.
Office boundary: pymupdf-office adds Office ingestion and PDF conversion, subject to a separate license.
Best For

Self-hosted RAG ingestion that needs structured extraction, tables, and verifiable page references from PDFs, with selective OCR for scans.

Skip If

You need a turnkey vector database or HTTP service, cannot meet the applicable license terms, or require Office ingestion without a separate license.

Reviewed on 2026-12-04 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

Self-HostedAPI
pip install --upgrade pymupdf

Comparison vs. Top RAG, Data & Memory Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
PyMuPDF ★11.2k+38PythonAGPL-3.0MuPDF-backed Python engine for layout-aware document ingestion and page groundin
MinerU84.7k+326Python—Local document parser and library for structured RAG ingestion and page-level ci
marker41.2k+103PythonApache-2.0Hybrid OCR and layout parsing for document ingestion in RAG pipelines
markitdown199.7k+909PythonMITPython library and CLI that turn mixed-format documents into Markdown for RAG in

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/pymupdf/PyMuPDF.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

pymupdf/PyMuPDF Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about PyMuPDF

How does PyMuPDF fit into a RAG ingestion service?

Run PyMuPDF inside a Python ingestion worker. Open documents with pymupdf.open(), use page.get_text("dict") for span coordinates or doc.to_markdown() for layout-aware text, and carry source document and page identifiers into your chunks. Embedding, indexing, retrieval, and any HTTP interface are separate components.

Does it need a GPU, and how should I size workers?

No GPU or VRAM allocation is required for the documented CPU path. Start with a representative batch and measure CPU time and peak memory separately for native text extraction, layout analysis, and OCR. Then size worker concurrency around scan frequency, page dimensions, and render DPI.

Can a proprietary or air-gapped service use it?

The core library can run locally, but self-hosting does not remove AGPL-3.0 obligations. Review how you modify, distribute, or offer the software over a network before choosing between AGPL and commercial terms. PyMuPDF Office is a separate extension with its own license key; keyless evaluation is time-limited and exposes only the first three pages of each document.

When should I choose it over a simpler Python parser or an OCR-first service?

Choose PyMuPDF when the same pipeline needs extraction, page rendering, table output, and geometric source references. For plain text from clean PDFs, a simpler pure-Python extractor may be sufficient. For scan-heavy workloads, compare OCR backends on your own languages and layouts; native PDF extraction cannot recover text that exists only as pixels.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining pymupdf/PyMuPDF? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature pymupdf/PyMuPDF on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare