Skip to main content

Rebased Python bindings for the PDF toolkit and renderer MuPDF - without shared libraries

Project description

PyMuPDF 1.23.0rc2

logo

Release date: August 18, 2023

On PyPI since August 2016: Downloads

Author

Artifex, based on code by Jorj X. McKie and Ruikai Liu.

Introduction

PyMuPDF adds Python bindings and abstractions to MuPDF, a lightweight PDF, XPS, and eBook viewer, renderer, and toolkit. Both PyMuPDF and MuPDF are maintained and developed by Artifex Software, Inc.

MuPDF can access files in PDF, XPS, OpenXPS, CBZ, EPUB, MOBI and FB2 (eBooks) formats, and it is known for its top performance and exceptional rendering quality.

With PyMuPDF you can access files with extensions like .pdf, .xps, .oxps, .cbz, .fb2, .mobi or .epub. In addition, about 10 popular image formats can also be handled like documents: .png, .jpg, .bmp, .tiff, .svg etc.

Usage

For all supported document types (i.e. including images) you can

  • Decrypt the document.
  • Access meta information, links and bookmarks.
  • Render pages in raster formats (PNG and some others), or the vector format SVG.
  • Search for text.
  • Extract text and images.
  • Convert to other formats: PDF, (X)HTML, XML, JSON, text.
  • Do OCR (Optical Character Recognition) if Tesseract is installed.

To some degree, PyMuPDF can also be used as an image converter: it can read a range of input formats and can produce Portable Network Graphics (PNG), Portable Anymaps (PNM, etc.), Portable Arbitrary Maps (PAM), Adobe PostScript and Adobe Photoshop documents, making the use of other graphics packages obselete in these cases. But interfacing with e.g. PIL/Pillow for image input and output is easy as well.

For PDF documents, there exists a plethora of additional features: they can be created, joined or split up. Pages can be inserted, deleted, re-arranged or modified in many ways (including annotations and form fields).

  • Images and fonts can be extracted or inserted.

    You may want to have a look at this cool GUI example script, which lets you insert, delete, replace or re-position images under your visual control.

    If fontTools is installed, subsets can be built for eligible fonts based on their usage in the document. Especially for new PDFs, this can lead to significant file size reductions.

  • Embedded files are fully supported.

  • PDFs can be reformatted to support double-sided printing, posterizing, applying logos or watermarks

  • Password protection is fully supported: decryption, encryption, encryption method selection, permission level and user / owner password setting.

  • Support of the PDF Optional Content concept for images, text and drawings.

  • Low-level PDF structures can be accessed and modified.

  • Command line module "python -m fitz ...". A versatile utility with the following features

    • encryption / decryption / optimization
    • creation of sub-documents
    • document joining
    • image / font extraction
    • full support of embedded files
    • layout-preserving text extraction (all documents)

Have a look at the basic demos, the examples (which contain complete, working programs), and notebooks.

Documentation

Documentation is written using Sphinx and is available online. It is currently a combination of a reference guide and user manual.

  • You can view it online at Read the Docs. This site also provides download options for PDF.
  • For a quick start look at the tutorial and the recipes chapters.

The latest changelog can be viewed here.

Installation

PyMuPDF requires Python 3.8 or later.

For versions 3.8 and up, Python wheels exist for Windows (32bit and 64bit), Linux (64bit, Intel and ARM) and Mac OSX (64bit, Intel only), so it can be installed from PyPI in the usual way. To ensure pip support for the latest wheel platform tags, we strongly recommend to always upgrade pip first.

python -m pip install --upgrade pip
python -m pip install --upgrade pymupdf

There are no mandatory external dependencies. However, some optional features become available only if additional packages are installed:

  • Pillow for using pillow image output directly from PyMuPDF
  • fontTools for creating font subsets.
  • pymupdf-fonts contains some nice fonts for your text output.
  • Tesseract-OCR for optical character recognition in images and document pages. Tesseract is separate software, not a Python package. To enable OCR functions in PyMuPDF, the system environment variable "TESSDATA_PREFIX" must be defined and contain the tessdata folder name of the Tesseract installation location.

Older wheels - also with support for older Python versions - can be found here and on PyPI.

Note: If pip cannot find a wheel that is compatible with your platform, it will automatically build and install from source using the PyMuPDF sdist; this requires only that SWIG is installed on your system.

Alternative 'rebased' implementation.

A new implementation of PyMuPDF is available as module fitz_new.

Benefits

  • Access to the underlying MuPDF Python API.

    The MuPDF Python API is available as fitz_new.mupdf - this is not possible with native PyMuPDF, and can give useful flexibility to the user.

  • Simplified implementation.

    The underlying MuPDF C++/Python APIs' automated reference counting, automatic contexts, and native C++ and Python exceptions, make the implementation simpler than classic PyMuPDF.

    This also simplifies development of new PyMuPDF functionality.

  • Optional tracing of MuPDF C function calls using environment variables.

    This is a feature of the MuPDF C++ and Python APIs, which can be very useful during development and when reporting bugs. See: https://mupdf.readthedocs.io/en/latest/language-bindings.html#environmental-variables

  • Possible future support for multithreaded use.

    Classic PyMuPDF is explicitly single-threaded, but the MuPDF C++/Python APIs have automated per-thread contexts.

Known issues

  • import fitz_new is known to fail with a SEGV on Windows with Python-3.10.

Secondary wheel PyMuPDFb

Installation of PyMuPDF with pip will automatically install a second wheel called PyMuPDFb containing Python-independent libraries.

License and Copyright

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

Please read the full text of the AGPL license agreement (which is also included here in file COPYING) to ensure that your use case complies with the guidelines of this license. If you determine you cannot meet the requirements of the AGPL, please contact Artifex for more information regarding a commercial license.

Artifex is the exclusive commercial licensing agent for MuPDF.

Artifex, the Artifex logo, MuPDF, and the MuPDF logo are registered trademarks of Artifex Software Inc. PyMuPDF and the PyMuPDF logo are trademarks of Artifex Software, Inc. © 2022 Artifex Software, Inc. All rights reserved.

Contact

Please use the Discussions menu for questions, comments, or asking for help, and submit issues here.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyMuPDF-1.23.0rc2.tar.gz (60.1 MB view details)

Uploaded Source

Built Distributions

PyMuPDF-1.23.0rc2-cp311-none-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.11 Windows x86-64

PyMuPDF-1.23.0rc2-cp311-none-win32.whl (3.2 MB view details)

Uploaded CPython 3.11 Windows x86

PyMuPDF-1.23.0rc2-cp311-none-manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.11

PyMuPDF-1.23.0rc2-cp311-none-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

PyMuPDF-1.23.0rc2-cp311-none-macosx_10_9_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

PyMuPDF-1.23.0rc2-cp310-none-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.10 Windows x86-64

PyMuPDF-1.23.0rc2-cp310-none-win32.whl (3.2 MB view details)

Uploaded CPython 3.10 Windows x86

PyMuPDF-1.23.0rc2-cp310-none-manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10

PyMuPDF-1.23.0rc2-cp310-none-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

PyMuPDF-1.23.0rc2-cp310-none-macosx_10_9_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

PyMuPDF-1.23.0rc2-cp39-none-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.9 Windows x86-64

PyMuPDF-1.23.0rc2-cp39-none-win32.whl (3.2 MB view details)

Uploaded CPython 3.9 Windows x86

PyMuPDF-1.23.0rc2-cp39-none-manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.9

PyMuPDF-1.23.0rc2-cp39-none-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

PyMuPDF-1.23.0rc2-cp39-none-macosx_10_9_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

PyMuPDF-1.23.0rc2-cp38-none-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.8 Windows x86-64

PyMuPDF-1.23.0rc2-cp38-none-win32.whl (3.2 MB view details)

Uploaded CPython 3.8 Windows x86

PyMuPDF-1.23.0rc2-cp38-none-manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.8

PyMuPDF-1.23.0rc2-cp38-none-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

PyMuPDF-1.23.0rc2-cp38-none-macosx_10_9_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file PyMuPDF-1.23.0rc2.tar.gz.

File metadata

  • Download URL: PyMuPDF-1.23.0rc2.tar.gz
  • Upload date:
  • Size: 60.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for PyMuPDF-1.23.0rc2.tar.gz
Algorithm Hash digest
SHA256 48a8d057373b1e501b5a8331506e2cf9ed292e0d9e1cd942fb4ea1b52160082e
MD5 50231618043b15840d0da3b1807f4525
BLAKE2b-256 dc64e2aa86e6cc8585d13f7429ffee8bb092307fd22d63033ef2b8c6b2d8f87b

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 cc2d50ee07a6683678bfac4d8973e8ce28a5fdcd51b8c611e47558ad81fd3153
MD5 779dc16eceab66cd73a0a0dcf648b6e4
BLAKE2b-256 20dc604f89a370d2737e3772e2095aa15df4a07bf37d292b9c6d8445296dfe27

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp311-none-win32.whl.

File metadata

  • Download URL: PyMuPDF-1.23.0rc2-cp311-none-win32.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp311-none-win32.whl
Algorithm Hash digest
SHA256 3044c621be11776c6bfb887171f8b196249392a9536a063d3e223dd8c3cda7ef
MD5 63ee8eda3228cba6e835c6ffab582af2
BLAKE2b-256 c499384f1dd2fdb2c8964f6d86ff663db01df79a5367e69e33bf457f6ff3d49a

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp311-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp311-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e63a7b8982f40cf0a2beb9c101e01cc59263c6e91db6fee12ed4b4317c82e563
MD5 d5a8483d30f393903157319c2ecef764
BLAKE2b-256 d6b8b0fdac4773e316905eb192f36f81564af03774537ee839700175268332bf

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp311-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp311-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 479332bcac2aebe798d56f3fafedfe8f1188c743ab1ff9b4bf2c106038f4529e
MD5 048099a80cd8f74864f1719a22f69273
BLAKE2b-256 f896dcbaad4addd1461d2d5bf59bf5fa4b233cb4aa2b83f826c1d5abc9fb128f

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp311-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp311-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1950154378d5fa951e81cde55ee47037cad2c94cf35ab14081939b2a66c40321
MD5 b703d0e847413a1ff15e91b68f71b5ed
BLAKE2b-256 0ea37d64138a01e34fb9bc01d938f89a2c75652f5a3f3d790d61b2f2ff6b4e05

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 42e726afcb4495c973f2fd479ffe038b908523a456b6b5e7eaa021b07c32544a
MD5 f25f471f3b872537ba1a03a4d6b87364
BLAKE2b-256 e51adfa850ec825ebb7e265cce68cdfcb420a3da8734cd80b1b853a9f0ffc256

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp310-none-win32.whl.

File metadata

  • Download URL: PyMuPDF-1.23.0rc2-cp310-none-win32.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp310-none-win32.whl
Algorithm Hash digest
SHA256 662a40698754827fefa7b10586f18f9340c62122629905c923982fc379f1da2f
MD5 93ae9a2c1c0c0b7fea63e62fcb2d8bb1
BLAKE2b-256 25d821c941ea97e46955aea8a18f8285c2586db498892af1d18e9749a90e7acf

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp310-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp310-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 77f09f20b3d06fd808c1599af35f0e5348d4cbc4a5e45a392153610564867123
MD5 46436553ac3427da773219406822d514
BLAKE2b-256 d9cd6eef41383312606b3c0c8ae9b802595901f60d879a0767b0289ec0334337

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp310-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp310-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6eb8c5cfadbf258d576514d7b0fc5cb24c45fe6e33dcd5cc368beb2e637137a7
MD5 c0a61819ff422a1742e4cc18e6af5284
BLAKE2b-256 60f9978a6ffcdc2b00178f1dc7c80824c3ef943302f38fcee6ca0806994a07ea

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp310-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp310-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cddd595c9da9406e71d4688bb2b074f638533dde61349fbb33318dc5f9162ec3
MD5 db402ea4742073652ba64517446f9a31
BLAKE2b-256 300fab3169d6c3bf0a3fb831b4003f0da1927898fddf610060c75368b4458deb

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 03fbd9cb2769c95fdc17981ba4e433b2b6f1f88812bb071e17ba06f35644e06d
MD5 ce0df386e2bf44bef5f467ba2b1d6e11
BLAKE2b-256 c0084f78d3f6dc08e2eca9fb5f9fa5da02415f54e02300d1b91a73bfa784dde9

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp39-none-win32.whl.

File metadata

  • Download URL: PyMuPDF-1.23.0rc2-cp39-none-win32.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp39-none-win32.whl
Algorithm Hash digest
SHA256 49208a49f7d550dec89a5031eb02b4c3e58e901faa664371d9592aae01f5e5fe
MD5 9ce5ae0df4fd7438abb38b2c39ca0a62
BLAKE2b-256 dea2936acdb99f7a814c8f5e9568b8721d86ee95057845c2b432ad062e79d4eb

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp39-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp39-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5578bf0e5fe1a240d5ee3093839842259ba17b02c3493060f9012245646f4025
MD5 67ecffb53acbbefc7d91932687cf83bf
BLAKE2b-256 0c8c45c0ae9e31d02f886cf5fec7167519e5ec19f4696ce5cd5ec0028c709952

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp39-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp39-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a84f55d05e054ef6b5fed828c6d2ecc7cc9e4ad5acf29f709ea2b0c370f9c993
MD5 0749da70caf6752d6468f99f329a2723
BLAKE2b-256 9bae11e26d541a1ede71d6d79031af9eb0af732c5cf6e7e0103a098041e7f01a

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp39-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp39-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2860c37c866c18e10a44255df5cad79bf1173bc2d45772d08fdcf6dad4331c4
MD5 9dc323cfb31bcdf2db8479869fcd5ca6
BLAKE2b-256 c9ee512505b96d087b509334ae89343444820499e6c729f0274f8cf1e700a993

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 00c09905f6e0540b8f0096c6baaab0b5ba99fdd32da287179588c08af0fb2105
MD5 356ad77139a9d07036918cece2503446
BLAKE2b-256 1fe24559e0849ec91294f11588dcc9027ef9ec5eca60e7db9c4bdc64f3a0b429

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp38-none-win32.whl.

File metadata

  • Download URL: PyMuPDF-1.23.0rc2-cp38-none-win32.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp38-none-win32.whl
Algorithm Hash digest
SHA256 cbe7a1a06a470f21fc99b4124db1ebd0859acd408c02e78734770b945137b67f
MD5 a70b5fe0c43d674c538c54589f1da037
BLAKE2b-256 efeeddb363f68af15aecb087002c1cea0157b9e0c15b91f29dd4d23372c64b35

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp38-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp38-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9cbc485bbda1b7651d67e4f617681c7a181dc2530cb500cc5c2c505267758d55
MD5 527b9bdb74b13c884188d4960a225215
BLAKE2b-256 b6f9e1a8e6554ec80810cad099e913a6edd0ca8d1e61878f3a4df66ac50dd7c3

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp38-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp38-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 458876c94fe559d22200f402ab076a3cf744fd8b8096ac0fe7b6d0e5bc0b5790
MD5 01128df6947a29f255e27656fe7b804c
BLAKE2b-256 b190e338eb4a54e7398b553a78febb658a15c400139e322664bbf64eeeda39d0

See more details on using hashes here.

File details

Details for the file PyMuPDF-1.23.0rc2-cp38-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for PyMuPDF-1.23.0rc2-cp38-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 334f5364320da066599ca56321b3c13b062c02e1960283730d0a0d25148f5a7b
MD5 a337fbc7fa5ee34c6443f679aa109e6c
BLAKE2b-256 fee45aa3b4984513880d003efd3f2372ec3639c93327f067230e911dcfd42aac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page