High-performance Python libraries for PDF processing, data extraction, and LLM document pipelines.
This organisation maintains Python libraries for working with PDF and other document formats β from low-level manipulation to LLM-ready data extraction.
PyMuPDF β core library
The foundation of everything here. PyMuPDF wraps the MuPDF C engine and exposes a full Python API for reading, rendering, editing, and converting PDF, XPS, EPUB, MOBI, CBZ, and image files.
pip install pymupdfimport pymupdf
doc = pymupdf.open("report.pdf")
page = doc[0]
print(page.get_text()) # extract text
pix = page.get_pixmap(dpi=150) # render to image
pix.save("page.png")Key capabilities: text and image extraction Β· page rendering at any DPI Β· annotation create/edit/delete Β· redaction Β· PDF creation and merging Β· encryption Β· OCR via Tesseract Β· form fields Β· 10+ output formats
β Documentation Β· PyPI Β· Changelog
pymupdf4llm β PDF β LLM-ready data
Turn any document into clean, structured data for RAG pipelines, vector stores, and LLM ingestion β in one line. No GPU, no cloud, no tokens required.
pip install pymupdf4llmimport pymupdf4llm
md = pymupdf4llm.to_markdown("paper.pdf") # Markdown
data = pymupdf4llm.to_json("paper.pdf") # JSON with bboxes
text = pymupdf4llm.to_text("paper.pdf") # plain textKey capabilities: layout-aware extraction Β· multi-column reading order Β· table detection β Markdown Β· smart hybrid OCR (only where needed) Β· page chunking with metadata Β· LlamaIndex and LangChain integrations Β· 10β250Γ cheaper than vision-LLM approaches
β Documentation Β· PyPI Β· Live demo
langchain-pymupdf4llm β LangChain integration
A drop-in LangChain document loader and parser backed by pymupdf4llm. Extracts PDF content as Markdown and feeds it directly into any LangChain retrieval chain.
pip install langchain-pymupdf4llmfrom langchain_pymupdf4llm import PyMuPDF4LLMLoader
loader = PyMuPDF4LLMLoader("document.pdf", mode="single")
docs = loader.load()β PyPI
pymupdf4llm-mcp β MCP server
An MCP (Model Context Protocol) server exposing pymupdf4llm as a tool. Gives any MCP-compatible AI client (Claude, Cursor, Windsurf) direct access to PDF-to-Markdown extraction.
uvx pymupdf4llm-mcp@latest stdioβ PyPI
PyMuPDF-Utilities β demos & examples
A collection of working example scripts, Jupyter notebooks, and GUI demos built on PyMuPDF. Covers image handling, annotation workflows, data extraction patterns, and more β useful as a recipe book alongside the official documentation.
β Browse examples
pymupdf-fonts β optional font collection
An optional font package extending the fonts available for text output in PyMuPDF. Includes additional Unicode-compatible typefaces beyond the 14 standard PDF fonts.
pip install pymupdf-fonts| Format | PyMuPDF | pymupdf4llm |
|---|---|---|
| PDF (all versions, encrypted) | β | β |
| XPS / OpenXPS | β | β |
| EPUB / MOBI / FB2 | β | β |
| CBZ / CBT (comic book) | β | β |
| Images (PNG, JPG, TIFFβ¦) | β | β (with OCR) |
| DOCX / XLSX / PPTX / HWP | β | β (Pro only) |
| SVG | β (limited) | β |
All repositories in this organisation are available under the GNU AGPL v3 for open-source use, and under a commercial licence for proprietary applications. Commercial licences are available from Artifex Software β the creators and maintainers of MuPDF, PyMuPDF, and this organisation.
Maintained by Artifex Software, Inc. Β· pymupdf.io