PyMuPDF
A high-performance Python library for extracting data from, analyzing, converting, rendering and manipulating PDF and other documents.
At a Glance
About PyMuPDF
PyMuPDF is a Python library maintained by Artifex Software, Inc. It is built on the MuPDF C engine and handles data extraction, analysis, conversion, rendering and manipulation of PDF and other document formats. The README says it has no mandatory external dependencies and installs with pip. The latest release listed is 1.28.2.
What It Is
PyMuPDF is a document-processing library for Python developers. After opening a file with pymupdf.open(), you can read text, tables and images, render pages, annotate, redact, merge, split and convert documents. It accepts PDF, XPS, EPUB, CBZ, MOBI, FB2, SVG, TXT, MD and common image formats. Output goes to PDF, SVG, images, Markdown, JSON or plain text.
Extraction and Editing Workflow
Text can be extracted as plain text, rich dictionaries with font, size, color and bounding boxes, HTML, XML or raw blocks. find_tables() locates tables and exports them as Markdown or Pandas DataFrames. OCR runs through Tesseract integration for scanned pages. On the editing side, the library covers annotations, permanent redaction, form filling, metadata, bookmarks, encryption and page insertion, deletion and reordering.
LLM and RAG Pipelines
The library can convert documents to Markdown, JSON or text for LLM and RAG use, with support for multi-column layouts, reading order and page chunking. The documentation also covers the PyMuPDF4LLM API. According to the README, everything runs locally and in-process, with no cloud calls, so it can be used in air-gapped environments.
Licensing and Extensions
The open-source edition is under GNU AGPL v3, and Artifex offers separate commercial licenses. The optional PyMuPDF Office extension adds DOC, DOCX, XLS, XLSX, PPT, PPTX, HWP and HWPX support. Without a license key it is limited to the first 3 pages of a document and an evaluation period. PyMuPDF does not support multithreading, so the README recommends multiprocessing for parallel work.
Community Discussions
Be the first to start a conversation about PyMuPDF
Share your experience with PyMuPDF, ask questions, or help others learn from your insights.
Pricing
Open Source (AGPL)
PyMuPDF core library under GNU AGPL v3; free for open-source projects. Works fully air-gapped with no license validation.
- GNU AGPL v3 license
- Free for open-source projects
- No telemetry, no license validation callbacks, no cloud dependencies
- Text extraction, table detection, OCR integration, annotations, redaction, PDF creation and editing
- Commercial licenses are separate for proprietary applications
Capabilities
Key Features
- Text extraction as plain text, dict, HTML, XML and blocks
- Table detection with Markdown and Pandas export
- Image extraction and page rendering
- OCR via Tesseract
- Annotations and permanent redaction
- PDF form reading and filling
- Merge, split and page editing
- Markdown, JSON and text output for LLM pipelines
- Markdown to PDF conversion
- Encryption, metadata and bookmarks
- Optional Office document support via PyMuPDF Office
