Repolode
pymupdf

pymupdf/PyMuPDF

A high-performance Python library for extracting, analyzing, converting, rendering and editing PDF and other document formats, built on the MuPDF engine.

Open-source alternative to:Adobe Acrobat

Stars
10,938
Forks
813
Open issues
58
Last commit
5 hours ago

What is it?

PyMuPDF is a Python binding for MuPDF, a lightweight C engine for PDF and other document formats. It lets Python code read text with font, size, color and position data, detect and export tables, render pages to images, and extract embedded images.

Beyond extraction, the library can annotate, redact, fill forms, edit pages, merge and split files, manage bookmarks and metadata, and create PDFs or convert Markdown to PDF. It also exports documents to Markdown, JSON and plain text, which suits LLM and RAG pipelines. OCR is available through RapidOCR or Tesseract, and the optional PyMuPDF Office extension adds support for Word, Excel, PowerPoint and HWP files.

Wheels are published for Windows, macOS and Linux on Python 3.11 and later. The project is licensed under AGPL-3.0, with commercial licenses offered by Artifex for proprietary use.

Key features

  • 01Extracts text with font, size, color and bounding-box metadata
  • 02Detects tables and exports them as Markdown or pandas DataFrames
  • 03Renders pages to PNG or JPEG at a chosen DPI
  • 04Adds annotations and permanently applies redactions
  • 05Reads and fills AcroForm fields
  • 06Exports documents to Markdown, JSON and plain text for LLM use
  • 07Runs OCR through RapidOCR or Tesseract

Use cases

  • Feeding PDF content into an LLM or RAG pipeline as structured Markdown
  • Pulling tables from financial or government reports into DataFrames
  • Redacting sensitive information from documents before sharing
  • Batch-merging, splitting or watermarking PDFs in a script

Quick start

  1. 1

    Install PyMuPDF from PyPI

    pip install --upgrade pymupdf
  2. 2

    Extract text from a PDF

    python -c "import pymupdf; doc = pymupdf.open('document.pdf'); [print(p.get_text()) for p in doc]"

Things to know

  • Office document support requires a license key, and without one only the first 3 pages are accessible.
  • Core library is AGPL-3.0 licensed, which has copyleft obligations for networked or distributed use.

Topics

FAQ

What is PyMuPDF?
A high-performance Python library for extracting, analyzing, converting, rendering and editing PDF and other document formats, built on the MuPDF engine. PyMuPDF is a Python binding for MuPDF, a lightweight C engine for PDF and other document formats. It lets Python code read text with font, size, color and position data, detect and export tables, render pages to images, and extract embedded images.
Is PyMuPDF free to use? What license does it have?
PyMuPDF is open source under the AGPL-3.0 license. Check the license terms before using it in commercial products.
Is PyMuPDF still maintained?
Actively maintained. The last commit to PyMuPDF was on Oct 20, 2026.
What can I use PyMuPDF for?
Feeding PDF content into an LLM or RAG pipeline as structured Markdown Pulling tables from financial or government reports into DataFrames Redacting sensitive information from documents before sharing Batch-merging, splitting or watermarking PDFs in a script
How do I install PyMuPDF?
Install PyMuPDF from PyPI: pip install --upgrade pymupdf Extract text from a PDF: python -c "import pymupdf; doc = pymupdf.open('document.pdf'); [print(p.get_text()) for p in doc]"
Where can I get PyMuPDF?
The source code and installation instructions are on GitHub: https://github.com/pymupdf/PyMuPDF

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects