All Projects → pymupdf → Pymupdf

pymupdf / Pymupdf

Licence: agpl-3.0
Python bindings for MuPDF's rendering library.

Labels

Projects that are alternatives of or similar to Pymupdf

Crowbook
Converts books written in Markdown to HTML, LaTeX/PDF and EPUB
Stars: ✭ 399 (-55.57%)
Mutual labels:  epub
Jieba fast
Use C Api and Swig to Speed up jieba 高效的中文分词库
Stars: ✭ 477 (-46.88%)
Mutual labels:  swig
Pythonocc Core
Python package for 3D CAD/BIM/PLM/CAM
Stars: ✭ 697 (-22.38%)
Mutual labels:  swig
Readium Js Viewer
👁 ReadiumJS viewer: default web app for Readium.js library
Stars: ✭ 438 (-51.22%)
Mutual labels:  epub
Plato
Document reader
Stars: ✭ 473 (-47.33%)
Mutual labels:  epub
Koodo Reader
A modern ebook manager and reader with sync and backup capacities for Windows, macOS, Linux and Web
Stars: ✭ 2,938 (+227.17%)
Mutual labels:  epub
Media Server Go
WebRTC media server for go
Stars: ✭ 362 (-59.69%)
Mutual labels:  swig
Ethereum Development With Go Book
📖 A little book on Ethereum Development with Go (golang)
Stars: ✭ 754 (-16.04%)
Mutual labels:  epub
Flapigen Rs
Tool for connecting programs or libraries written in Rust with other languages
Stars: ✭ 473 (-47.33%)
Mutual labels:  swig
Leanify
lightweight lossless file minifier/optimizer
Stars: ✭ 694 (-22.72%)
Mutual labels:  epub
Wiringpi Python
Unofficial Python-wrapped version of Gordon Henderson's WiringPi version 2.
Stars: ✭ 438 (-51.22%)
Mutual labels:  swig
Simpleitk
SimpleITK: a layer built on top of the Insight Toolkit (ITK), intended to simplify and facilitate ITK's use in rapid prototyping, education and interpreted languages.
Stars: ✭ 458 (-49%)
Mutual labels:  swig
Google Sre Ebook
Google SRE Book Generator (EPUB/MOBI/PDF).
Stars: ✭ 578 (-35.63%)
Mutual labels:  epub
Intel Cmt Cat
User space software for Intel(R) Resource Director Technology
Stars: ✭ 400 (-55.46%)
Mutual labels:  swig
Easybook
Book publishing as easy as it should be (built with Symfony components)
Stars: ✭ 744 (-17.15%)
Mutual labels:  epub
Epub Press Clients
📦 Clients for building books with EpubPress.
Stars: ✭ 370 (-58.8%)
Mutual labels:  epub
Calibre Web
📚 Web app for browsing, reading and downloading eBooks stored in a Calibre database
Stars: ✭ 5,616 (+525.39%)
Mutual labels:  epub
Booktype
Booktype is a free, open source platform that produces beautiful, engaging books formatted for print, Amazon, iBooks and almost any ereader within minutes.
Stars: ✭ 810 (-9.8%)
Mutual labels:  epub
Ebooklib
Python E-book library for handling books in EPUB2/EPUB3 format -
Stars: ✭ 745 (-17.04%)
Mutual labels:  epub
Epr
CLI Epub Reader
Stars: ✭ 657 (-26.84%)
Mutual labels:  epub

PyMuPDF 1.18.9

logo

Release date: February 28, 2021

Travis-CI: Build Status

On PyPI since August 2016: Downloads

Authors

Introduction

PyMuPDF (current version 1.18.9) is a Python binding with support for MuPDF (current version 1.18.*), a lightweight PDF, XPS, and E-book viewer, renderer, and toolkit, which is maintained and developed by Artifex Software, Inc.

MuPDF can access files in PDF, XPS, OpenXPS, CBZ, EPUB and FB2 (e-books) formats, and it is known for its top performance and high rendering quality.

With PyMuPDF you can access files with extensions like “.pdf”, “.xps”, “.oxps”, “.cbz”, “.fb2” or “.epub”. In addition, about 10 popular image formats can also be opened and handled like documents.

In partnership with Artifex, PyMuPDF is now also available for commercial licensing. This agreement has no impact on use cases, that are compliant with the open-source license AGPL. Please see the “License and Copyright” section below for additional information.

Usage and Documentation

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

To some degree, PyMuPDF can therefore 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 plethorea 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.

    Since v1.18.8 there is a new experimental Document method subset_fonts(), which automatically builds subsets based on the usage of all eligible fonts in the document. Especially for new documents, this can lead to significant file size reductions. The method was developed in cooperation with our user @cuteufo - again thanks a lot for the contribution.

  • 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, permmission 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.

  • PyMuPDF can also be used as a module in the command line using "python -m fitz ...". This is a versatile utility, which we will further develop going forward. It currently supports PDF document

    • encryption / decryption / optimization
    • creating sub-documents
    • document joining
    • image / font extraction
    • full support of embedded files.

Have a look at the basic demos, the examples (which contain complete, working programs), and the recipes section of our Wiki sidebar, which contains more than a dozen of guides in How-To-style.

Our documentation, written using Sphinx, is available in various formats from the following sources. It currently is a combination of a reference guide and a user manual. For a quick start look at the tutorial and the recipes chapters.

  • You can view it online at Read the Docs. This site also provides download options for PDF.
  • The search function on Read the Docs does not work for me currently. If you want a working searchable local version, please download a zipped HTML for here.
  • Find a Windows help file here.

Installation

For Windows, Linux and Mac OSX platforms, there are wheels in the download section of PyPI. This includes Python 64bit versions 3.6 through 3.9. For Windows only, 32bit versions are available too.

If your platform is not supported with one of our wheels, you need to generate PyMuPDF yourself as follows. This requires the development version of Python.

Before you can do that, you must first build MuPDF. For most platforms, the MuPDF sources contain prepared procedures for achieving this. Please observe the following general steps:

  • Be sure to download the official MuPDF source release from here. Do not use MuPDF's GitHub repo. It contains their development source for future versions.

  • This repo's fitz folder contains one or more files whose names start with a single underscore "_". These files contain configuration data and potentially other fixes. Copy-rename each of them to their correct target location within the downloaded MuPDF source. Currently, these files are:

    • Optional: fitz configuration file _config.h copy-replace to: mupdf/include/mupdf/fitz/config.h. It contains configuration data like e.g. which fonts to support. If omitting this change, the binary extension module will be over 30 MB (compared to around 11 MB). Does not impact functionality.

    • Now MuPDF can be generated.

  • Please note that you will need the interface generator SWIG when building PyMuPDF from the sources of this repository (please refer to issue #312 for some background on this).

    • PyMuPDF wheels are being generated using SWIG v4.0.1.
  • If you do not use SWIG, please download the sources from PyPI - they contain sources pre-processed by SWIG, so installation should work like any other Python extension generation on your system.

Once this is done, adjust directories in setup.py and run python setup.py install.

The following sections contain further comments for some platforms.

Ubuntu

Our users (thanks to @gileadslostson and @jbarlow83!) have documented their MuPDF installation experiences from sources in this Wiki page.

OSX

First, install the MuPDF headers and libraries, which are provided by mupdf-tools: brew install mupdf-tools.

Then you might need to export ARCHFLAGS='-arch x86_64', since libmupdf.a is for x86_64 only.

Finally, please double check setup.py before building. Update include_dirs and library_dirs if necessary.

MS Windows

If you are looking to make your own binary, consult this Wiki page. It explains how to use Visual Studio for generating MuPDF in quite some detail.

Earlier Versions

Earlier versions are available in the releases directory.

License and Copyright

In order to comply with MuPDF’s dual licensing model, PyMuPDF has entered into an agreement with Artifex who has the right to sublicense PyMuPDF to third parties.

PyMuPDF and MuPDF are now 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. © 2021 Artifex Software, Inc. All rights reserved.

Contact

Please use the Discussions menu for questions, comments, or asking others for help, and submit issues here. If you wish, you can also contact me directly via [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].