Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

**The PDF engine behind over 50 million monthly downloads, powering AI pipelines worldwide.**

**PyMuPDF is a high-performance Python library for data extraction, layout analysis, conversion, rendering and manipulation of PDF (and other) documents.** Built on top of MuPDF — a lightweight, fast C engine — PyMuPDF gives you precise, low-level control over documents alongside high-level convenience APIs.
**PyMuPDF is a layout-aware document engine for AI and a feature-rich Python toolkit for extracting, rendering and editing PDFs and other documents**. Since version 2.0, its ML-based layout analysis turns PDFs and Office files into high-quality Markdown for RAG and agents, running fast on CPU and grounding every result to its source page.

[![Star on GitHub](https://img.shields.io/github/stars/pymupdf/PyMuPDF.svg?style=for-the-badge&label=Star&logo=github)](https://github.com/pymupdf/PyMuPDF/)

Expand All @@ -36,7 +36,7 @@
- **Accurate** — pixel-perfect text extraction with font, color, and position metadata
- **Versatile** — read, write, annotate, redact, merge, split, and convert documents
- **LLM-ready** — structured data with JSON & native Markdown output for RAG and AI pipelines
- **Grounded results** — improved, verifiable results, see: [PyMuPDF & Grounding](https://pymupdf.readthedocs.io/en/latest/grounding.html?utm_source=github&utm_medium=referral&utm_campaign=pymupdf_github&utm_content=documentation_community&utm_term=pymupdf_grounding)
- **Grounded results** — improved, verifiable results, see: [PyMuPDF & Grounding](https://pymupdf.io/grounding/?utm_source=github&utm_medium=referral&utm_campaign=pymupdf_github&utm_content=documentation_community&utm_term=pymupdf_grounding)

---

Expand All @@ -54,8 +54,6 @@ pip install --force-reinstall --no-cache-dir pymupdf

This will ensure a clean installation of PyMuPDF.



### Wheels

Wheels are available for **Windows**, **macOS**, and **Linux** on Python 3.11–3.15. If no pre-built wheel exists for your platform, pip will compile from source (requires a C/C++ toolchain).
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Welcome to |PyMuPDF|
================================

|PyMuPDF| is a high-performance **Python** library for data extraction, analysis, conversion & manipulation of |PDF| (and other) documents.
|PyMuPDF| is a layout-aware document engine for AI and a feature-rich **Python** toolkit for extracting, rendering and editing PDFs and other documents. Since version 2.0, its ML-based layout analysis turns PDFs and Office files into high-quality |Markdown| for RAG and agents, running fast on CPU and grounding every result to its source page.

|PyMuPDF| is hosted on `GitHub <https://github.com/pymupdf/PyMuPDF>`_ and registered on `PyPI <https://pypi.org/project/PyMuPDF/>`_.

Expand Down
36 changes: 29 additions & 7 deletions docs/llms/llms-full.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# PyMuPDF

> PyMuPDF is a high-performance Python library for data extraction, analysis, conversion and manipulation of PDF (and other) documents. It includes PyMuPDF4LLM, a companion package specifically designed for LLM and RAG pipelines.
> PyMuPDF is a layout-aware document engine for AI and a feature-rich Python toolkit for extracting, rendering and editing PDFs and other documents. Since version 2.0, its ML-based layout analysis turns PDFs and Office files into high-quality Markdown for RAG and agents, running fast on CPU and grounding every result to its source page.

PyMuPDF is hosted on [GitHub](https://github.com/pymupdf/PyMuPDF) and registered on [PyPI](https://pypi.org/project/PyMuPDF/). It wraps MuPDF, a lightweight PDF/XPS/eBook viewer and toolkit.
PyMuPDF is hosted on [GitHub](https://github.com/pymupdf/PyMuPDF) and registered on [PyPI](https://pypi.org/project/PyMuPDF/). It is built on top of [MuPDF](https://mupdf.com).

---

## Installation

```
pip install pymupdf
pip install pymupdf4llm
```

Import as:

```python
import pymupdf
import pymupdf4llm
```

---
Expand Down Expand Up @@ -95,7 +93,14 @@ pix.save("page-0.png")

## PyMuPDF4LLM

PyMuPDF4LLM is a lightweight extension for PyMuPDF that converts documents into structured Markdown, JSON, and plain text optimised for RAG pipelines, vector embeddings, and LLM ingestion. It handles multi-column layouts, tables, images, headers, and scanned pages with automatic OCR — all powered by the MuPDF C engine.
PyMuPDF4LLM converts documents into structured Markdown, JSON, and plain text optimised for RAG pipelines, vector embeddings, and LLM ingestion. It handles multi-column layouts, tables, images, headers, and scanned pages with automatic OCR — all powered by the MuPDF C engine.

**Since PyMuPDF 2.0, PyMuPDF4LLM and PyMuPDF Layout are included in the main `pymupdf` package by default.** `pip install pymupdf` is all you need; there is no separate package to install. You can use the features in two ways:

- As `Document` methods: `doc.to_markdown()`, `doc.to_json()` and `doc.to_text()`
- Through the `pymupdf4llm` module: `pymupdf4llm.to_markdown(...)`, as in the examples below

Layout analysis is on by default. Call `pymupdf.use_layout(False)` to turn it off.

### Key Features

Expand All @@ -110,13 +115,30 @@ PyMuPDF4LLM is a lightweight extension for PyMuPDF that converts documents into
### Installation

```
pip install pymupdf4llm
pip install --upgrade pymupdf
```

This installs PyMuPDF together with PyMuPDF4LLM and PyMuPDF Layout. Do not install `pymupdf4llm` or `pymupdf-layout` separately on PyMuPDF 2.0 or later. If an earlier separate install broke your environment, repair it with:

```
pip install --force-reinstall --no-cache-dir pymupdf
```

Tesseract must be installed separately if OCR is needed.
OCR needs at least one OCR engine, such as RapidOCR or Tesseract, installed separately.

### Basic Usage

```python
import pymupdf

doc = pymupdf.open("input.pdf")
md_text = doc.to_markdown() # Markdown
json_text = doc.to_json() # JSON string
plain_text = doc.to_text() # plain text
```

The same conversion through the `pymupdf4llm` module:

```python
import pymupdf4llm

Expand Down
4 changes: 2 additions & 2 deletions docs/llms/llms.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PyMuPDF

> PyMuPDF is a high-performance Python library for data extraction, analysis, conversion and manipulation of PDF (and other) documents. It includes PyMuPDF4LLM, a companion package specifically designed for LLM and RAG pipelines that converts documents into structured Markdown, JSON, and plain text.
> PyMuPDF is a layout-aware document engine for AI and a feature-rich Python toolkit for extracting, rendering and editing PDFs and other documents. Since version 2.0, its ML-based layout analysis turns PDFs and Office files into high-quality Markdown for RAG and agents, running fast on CPU and grounding every result to its source page.

PyMuPDF is hosted on [GitHub](https://github.com/pymupdf/PyMuPDF) and registered on [PyPI](https://pypi.org/project/PyMuPDF/). It is built on top of MuPDF, a lightweight PDF and XPS viewer.
PyMuPDF is hosted on [GitHub](https://github.com/pymupdf/PyMuPDF) and registered on [PyPI](https://pypi.org/project/PyMuPDF/). It is built on top of [MuPDF](https://mupdf.com).

## Docs

Expand Down
Loading