# PyMuPDF

> A high-performance Python library for extracting data from, analyzing, converting, rendering and manipulating PDF and other documents.

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.

## 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

## Integrations
MuPDF, Tesseract OCR, Pandas, NumPy, PyPI, LlamaIndex

## Platforms
WINDOWS, MACOS, LINUX, API, DEVELOPER_SDK

## Pricing
Open Source

## Version
1.28.2

## Links
- Website: https://pymupdf.readthedocs.io/?utm_source=github&utm_medium=referral&utm_campaign=pymupdf_github&utm_content=about&utm_term=docs
- Documentation: https://pymupdf.readthedocs.io/en/latest/
- Repository: https://github.com/pymupdf/PyMuPDF
- EveryDev.ai: https://www.everydev.ai/tools/pymupdf
