PyMuPDF is the clear choice for Python developers looking to tap into powerful API functionality for PDF.

Casestudy

Read our latest Casestudy

Available via PyPi

Install easily with: pip install PyMuPDF
DOWNLOADS ON PYPI *
* This shows the download figures from PyPi and the average download rate @ around one per 1.4 seconds! Yes, we know this isn't 100% accurate, enjoy responsibly 🙂


File Loader


PyMuPDF Terminal

Extensive documentation, version controlled with Read the Docs

Get started quickly with the basics or dive into the full API.

Open Source Software (and always will be)

Find us on Github, feel free to contribute!

Discover the PyMuPDF online web console

Please run the samples and/or type your own Python code to learn PyMuPDF.

Print the version of PyMuPDF

pymupdf.version
        

Load a document from the web

import pyodide.http
r = await pyodide.http.pyfetch('https://pymupdf.io/docs/mupdf_explored.pdf')
data = await r.bytes()
doc = pymupdf.Document(stream=data)
print(f'Is PDF: {doc.is_pdf}')
print(f'Number of pages: {doc.page_count}')
        

Count the pages in a document

import pyodide.http
r = await pyodide.http.pyfetch('https://pymupdf.io/docs/mupdf_explored.pdf')
data = await r.bytes()
doc = pymupdf.Document(stream=data)
for page in doc:
    print(f'Page: {page.number}')
        

Find the annotations in a document

import pyodide.http
r = await pyodide.http.pyfetch('https://pymupdf.io/docs/mupdf_explored.pdf')
data = await r.bytes()
doc = pymupdf.Document(stream=data)
for page in doc:
    for annot in page.annots():
        print(f'Annotation on page: {page.number} with type: {annot.type} and rect: {annot.rect}')
        

Licensing

PyMuPDF is available under both, open-source AGPL and commercial license agreements.

If you determine you cannot meet the requirements of the AGPL, please contact Artifex for more information regarding a commercial license.