#1082023 python3-fitz: PyMuPDF is not build with OCR support

Package:
python3-fitz
Source:
python3-fitz
Description:
Python binding for MuPDF
Submitter:
Alex Pyrgiotis
Date:
2026-08-06 03:03:02 UTC
Severity:
normal
Tags:
#1082023#5
Date:
2024-09-17 16:21:03 UTC
From:
To:
Dear Maintainer,

PyMuPDF has built-in OCR support, based on Tesseract. See:

https://pymupdf.readthedocs.io/en/latest/recipes-ocr.html

The python3-fitz package in Debian lacks this support though. Is there
any particular reason why this is the case? If not, is it possible to
enable it?

Thanks,
Alex

#1082023#10
Date:
2026-06-10 22:02:53 UTC
From:
To:
Hi Alex, and the mupdf maintainers,

The fact that pymupdf is not able to use OCR seem to be related to the
fact that mupdf is compiled without support for it, and so I'm
reassigning this issue to src:mupdf.

I'm attaching a patch to enable OCR using Tesseract and Leptonica.
This would enable an use via pymudf, amongst other things.

It would mean all mupdf users would fetch tesseract and leptonica, but
the data files aren't actually required.

Would you be keep to add such dependencies, to add support for doing
OCR? It would enable a set of use cases, especially automatically doing
OCR and add a layer of invisible text on top of PDFs built by mupdf.

All the best,
Alexis

PS: That's my first time with the BTS, and so I hope I did things right :-)
------ BEGIN PATCH ------

diff --git a/debian/control b/debian/control
index dff28c5..6c30d6c 100644
--- a/debian/control
+++ b/debian/control
@@ -19,9 +19,11 @@ Build-Depends: afdko-bin:native,
                 libjbig2dec0-dev (>= 0.20),
                 libjpeg-dev,
                 liblcms2-dev,
+               libleptonica-dev,
                 libmujs-dev (>= 1.3.8),
                 libopenjp2-7-dev,
                 libssl-dev,
+               libtesseract-dev,
                 libx11-dev,
                 libxext-dev,
                 libxrandr-dev,
diff --git a/debian/rules b/debian/rules
index a496f69..dfc9c0d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -43,6 +43,10 @@ BUILD_FLAGS += USE_SYSTEM_MUJS=yes
  BUILD_FLAGS += USE_SYSTEM_LIBS=yes
  # Force using system lcms2 (was not included in default system library
set)
  BUILD_FLAGS += USE_SYSTEM_LCMS2=yes
+# Enable Tesseract OCR support, linking against the system tesseract and
+# leptonica libraries. This appends "-tesseract" to the build suffix,
+# so keep LIB_DIR below in sync.
+BUILD_FLAGS += tesseract=yes USE_SYSTEM_TESSERACT=yes
USE_SYSTEM_LEPTONICA=yes
  BUILD_FLAGS += LD=$(DEB_HOST_GNU_TYPE)-ld

  ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
@@ -73,7 +77,7 @@ override_dh_auto_install:
         install -m744 -T $(CURDIR)/debian/mupdf.sh
$(CURDIR)/debian/tmp/usr/bin/mupdf
         sh debian/install_icons.sh
  ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-       $(MAKE) -C $(CURDIR)/debian/tests test
LIB_DIR=$(CURDIR)/build/shared-debug-Py_LIMITED_API_0x030d0000
+       $(MAKE) -C $(CURDIR)/debian/tests test
LIB_DIR=$(CURDIR)/build/shared-debug-Py_LIMITED_API_0x030d0000-tesseract
  endif

  override_dh_gencontrol:
------ END PATCH ------
#1082023#23
Date:
2026-06-10 21:51:58 UTC
From:
To:
Hi Alex, and the mupdf maintainers,

The fact that pymupdf is not able to use OCR seem to be related to the
fact that mupdf is compiled without support for it, and so I'm
reassigning this issue to src:mupdf.

I'm attaching a patch to enable OCR using Tesseract and Leptonica.
This would enable an use via pymudf, amongst other things.

It would mean all mupdf users would fetch tesseract and leptonica, but
the data files aren't actually required.

Would you be keep to add such dependencies, to add support for doing
OCR? It would enable a set of use cases, especially automatically doing
OCR and add a layer of invisible text on top of PDFs built by mupdf.

All the best,
Alexis

PS: That's my first time with the BTS, and so I hope I did things right :-)
------ BEGIN PATCH ------ diff --git a/debian/control b/debian/control index dff28c5..6c30d6c 100644 --- a/debian/control +++ b/debian/control @@ -19,9 +19,11 @@ Build-Depends: afdko-bin:native, libjbig2dec0-dev (>= 0.20), libjpeg-dev, liblcms2-dev, + libleptonica-dev, libmujs-dev (>= 1.3.8), libopenjp2-7-dev, libssl-dev, + libtesseract-dev, libx11-dev, libxext-dev, libxrandr-dev, diff --git a/debian/rules b/debian/rules index a496f69..dfc9c0d 100755 --- a/debian/rules +++ b/debian/rules @@ -43,6 +43,10 @@ BUILD_FLAGS += USE_SYSTEM_MUJS=yes BUILD_FLAGS += USE_SYSTEM_LIBS=yes # Force using system lcms2 (was not included in default system library set) BUILD_FLAGS += USE_SYSTEM_LCMS2=yes +# Enable Tesseract OCR support, linking against the system tesseract and +# leptonica libraries. This appends "-tesseract" to the build suffix, +# so keep LIB_DIR below in sync. +BUILD_FLAGS += tesseract=yes USE_SYSTEM_TESSERACT=yes USE_SYSTEM_LEPTONICA=yes BUILD_FLAGS += LD=$(DEB_HOST_GNU_TYPE)-ld ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) @@ -73,7 +77,7 @@ override_dh_auto_install: install -m744 -T $(CURDIR)/debian/mupdf.sh $(CURDIR)/debian/tmp/usr/bin/mupdf sh debian/install_icons.sh ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) - $(MAKE) -C $(CURDIR)/debian/tests test LIB_DIR=$(CURDIR)/build/shared-debug-Py_LIMITED_API_0x030d0000 + $(MAKE) -C $(CURDIR)/debian/tests test LIB_DIR=$(CURDIR)/build/shared-debug-Py_LIMITED_API_0x030d0000-tesseract endif override_dh_gencontrol:
------ END PATCH ------
#1082023#30
Date:
2026-07-21 01:29:24 UTC
From:
To:
Hello!

Thanks for the patch! It seems to be working.. I'll try to include it in
the next release 1.28.

Regards!

#1082023#35
Date:
2026-08-06 03:00:36 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
mupdf, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1082023@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Daniel Echeverri <epsilon@debian.org> (supplier of updated mupdf package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Fri, 31 Jul 2026 22:57:10 -0500
Source: mupdf
Binary: libmupdf-dev libmupdf28.0 libmupdf28.0-dbgsym mupdf mupdf-dbgsym mupdf-doc mupdf-tools mupdf-tools-dbgsym python3-mupdf python3-mupdf-dbgsym
Architecture: source amd64 all
Version: 1.28.0+ds1-1
Distribution: experimental
Urgency: medium
Maintainer: Kan-Ru Chen (陳侃如) <koster@debian.org>
Changed-By: Daniel Echeverri <epsilon@debian.org>
Description:
 libmupdf-dev - development files for the MuPDF viewer
 libmupdf28.0 - shared library for the MuPDF viewer
 mupdf      - lightweight PDF viewer
 mupdf-doc  - documentation for the MuPDF library and tools
 mupdf-tools - command line tools for the MuPDF viewer
 python3-mupdf - Python bindings for MuPDF library
Closes: 1082023
Changes:
 mupdf (1.28.0+ds1-1) experimental; urgency=medium
 .
   * New upstream version 1.28.0+ds1
   * debian/control
     + Add libleptonica-dev, libtesseract-dev, libcmark-gfm-dev,
       libcmark-gfm-extensions-dev, doxygen in B-D
     + Rename lib package to libmupdf28.0 for new soname
     + Add mupdf-doc package
   * debian/patches
     + Add patches
       + 0015-fix-cmark-gfm-libs-typo.diff
       + 0016-docs-conf-no-venv.diff
       + 0017-make-doc-reproducible.diff
       + 0018-remove-cmark-extension.diff
     + Remove patches, merge with upstream
       + CVE-2026-25556.patch
       + CVE-2026-3308.patch
       + CVE-2026-40505.patch
       + fix-mutool-manpage-groff-errors.patch
     + Refresh patches
       + 0001-mupdf_manpage.patch
       + 0004-use-debian-flavor-build-options.patch
       + 0005-MuPDF-crossbuild-use-target-arch-pkg-config.patch
       + 0006-MuPDF-crossbuild-use-host-cc-for-utils.patch
       + 0008-Add-fallback-for-missing-SA_NOCLDWAIT.patch
       + 0010_add_missing_hardening_flags.diff
       + 0012-exclude-unavailable-noto-fonts.patch
       + 0013-remove-unavailable-sphinx-extensions.patch
       + fix-manpages-errors.patch
   * debian/rules
     + Enable OCR support (Closes: #1082023)
       + Thanks to Alexis Métaireau for the patch
     + Install documentation in mupdf-doc package
   * debian/copyright
     + Exclude bundled thirdparty/cmark-gfm, we use system lib instead
   * Update symbols file
   * Rename libmupdf27.0.install to libmupdf28.0.install
   * Rename mupdf.doc-base to mupdf-doc.doc-base
   * Rename mupdf.links to mupdf-doc.links
Checksums-Sha1:
 dd48048a2ab9e9a27d96bde65c0e4e2cb11e9221 2917 mupdf_1.28.0+ds1-1.dsc
 e064eee70f120f42f21fef8a447fa25b91478a41 6176572 mupdf_1.28.0+ds1.orig.tar.xz
 22f9962c1841223cc53e62d52242b123071e0f72 113368 mupdf_1.28.0+ds1-1.debian.tar.xz
 efb31efaaa61bb527ac763404d814ac58e1922a2 299800 libmupdf-dev_1.28.0+ds1-1_amd64.deb
 2dac6bf552d54845ecd975cdc0bdcc201858ebfe 5561820 libmupdf28.0-dbgsym_1.28.0+ds1-1_amd64.deb
 04de120b1e7d19375923301bdc909b2d1e33700e 31746460 libmupdf28.0_1.28.0+ds1-1_amd64.deb
 9c7d89b57e3962dfc6bde6313b125c51ef586eb5 371292 mupdf-dbgsym_1.28.0+ds1-1_amd64.deb
 38b44b773e06dea0885e8b62f79ec642d6f51961 2042588 mupdf-doc_1.28.0+ds1-1_all.deb
 437aa53f2e7161c31aa4c9ae382eb49c84dde594 554424 mupdf-tools-dbgsym_1.28.0+ds1-1_amd64.deb
 d0a5fd19f32cf88b69276fe3ff3257ba39c0e394 215780 mupdf-tools_1.28.0+ds1-1_amd64.deb
 f4f52b0ee410fba28d3861752f72571d9c0b5688 19859 mupdf_1.28.0+ds1-1_amd64.buildinfo
 a13a98d782a9f7aeb0f6af58af10eab7b01303e4 916660 mupdf_1.28.0+ds1-1_amd64.deb
 98f73df7485f4e16cd7d969ae461fec19031b45c 12555504 python3-mupdf-dbgsym_1.28.0+ds1-1_amd64.deb
 4d1600455f9975f96db27664adf35894ab32c5fa 4151492 python3-mupdf_1.28.0+ds1-1_amd64.deb
Checksums-Sha256:
 34fa1dc105e239f1c3b39c11a1acaea459ddac5186cf1a576a2feb1235e3e026 2917 mupdf_1.28.0+ds1-1.dsc
 14aace203f2887545cf92b5ef96fc22a1a3464dc883892db659b8fd1d2d39d43 6176572 mupdf_1.28.0+ds1.orig.tar.xz
 9c2a438d282257526e1b0e4cb7532fbca9f737d5e2fbcdc8109d49e412abc7d6 113368 mupdf_1.28.0+ds1-1.debian.tar.xz
 b0a889e2490b3c965eaf7436fbbed77a24deac407d5226b7d0b3c6cbdc228c83 299800 libmupdf-dev_1.28.0+ds1-1_amd64.deb
 2b662b9111822c3747c703d2b92cd3e9fc6242e758a1307a1ed840bef6a51447 5561820 libmupdf28.0-dbgsym_1.28.0+ds1-1_amd64.deb
 2e0261f5d0f7d1c9d79ae016d03d63baf2814e08f472b89384f0fe84b227437a 31746460 libmupdf28.0_1.28.0+ds1-1_amd64.deb
 b88faa892a52a3407f454bab61cf3a8ef632fbd391ae195799bad6a604a07bee 371292 mupdf-dbgsym_1.28.0+ds1-1_amd64.deb
 85a1b679f5322384109b721143347d182a6a316f8911a900c600877d839cb3f3 2042588 mupdf-doc_1.28.0+ds1-1_all.deb
 e65cd7844e961bbd2147e685aa728ff6ecfeac03dc3846e5b5df57fe7f397eab 554424 mupdf-tools-dbgsym_1.28.0+ds1-1_amd64.deb
 879d044cb84671b331df95114e1799e477299ca503f96dbc213814c02f5a109a 215780 mupdf-tools_1.28.0+ds1-1_amd64.deb
 4e2691ad2ca7c9f99ce9318def60a573762613343b0674dd089b5268d7d4744d 19859 mupdf_1.28.0+ds1-1_amd64.buildinfo
 e79bd839822bbb9f8ccad0ff38c80db595da1ba3ca2988cf8ad2b2c2cc99d8e4 916660 mupdf_1.28.0+ds1-1_amd64.deb
 354d48b35cee418ce6feaa048505db5d4744f638078aae117c930559f8d1a7fd 12555504 python3-mupdf-dbgsym_1.28.0+ds1-1_amd64.deb
 2c4e430378aaa7caa630ef263206b2b0b26a4cc3ba6500c002d35b8489366cfb 4151492 python3-mupdf_1.28.0+ds1-1_amd64.deb
Files:
 b136e48fab72cfb98dbc9dbbd1d42f29 2917 text optional mupdf_1.28.0+ds1-1.dsc
 2dc430123bfa3221a0bf0c14ef37ee40 6176572 text optional mupdf_1.28.0+ds1.orig.tar.xz
 ca781b609599c360fba545703cf2cc9d 113368 text optional mupdf_1.28.0+ds1-1.debian.tar.xz
 ae2c356b08b98681327888a4b8040a06 299800 libdevel optional libmupdf-dev_1.28.0+ds1-1_amd64.deb
 d72488b5afc7505ea6aff01b521b2e64 5561820 debug optional libmupdf28.0-dbgsym_1.28.0+ds1-1_amd64.deb
 3af60bb764340326e6383f5bf3eb5fcf 31746460 libs optional libmupdf28.0_1.28.0+ds1-1_amd64.deb
 664ff73f4643140948b448a827bdc91d 371292 debug optional mupdf-dbgsym_1.28.0+ds1-1_amd64.deb
 c0cd1bcffb41bad2624c469db8ef5167 2042588 doc optional mupdf-doc_1.28.0+ds1-1_all.deb
 d019a7489015133a7b32a79a193f4625 554424 debug optional mupdf-tools-dbgsym_1.28.0+ds1-1_amd64.deb
 b21a4c41b05db51febd0038c41e6f074 215780 text optional mupdf-tools_1.28.0+ds1-1_amd64.deb
 f077669da72506f15d91e7d7a9ca868b 19859 text optional mupdf_1.28.0+ds1-1_amd64.buildinfo
 00619e84fea37c14e96ade407ccab8ed 916660 text optional mupdf_1.28.0+ds1-1_amd64.deb
 02902403492a765956a5f1f1356f870b 12555504 debug optional python3-mupdf-dbgsym_1.28.0+ds1-1_amd64.deb
 019754ad5c28d23c964cc3145caf1f5e 4151492 text optional python3-mupdf_1.28.0+ds1-1_amd64.deb
-----BEGIN PGP SIGNATURE-----

iQJHBAEBCgAxFiEE0NCFsWnDv9lASFj6IfwpUEtSMNsFAmpthdYTHGVwc2lsb25A
ZGViaWFuLm9yZwAKCRAh/ClQS1Iw220rEAC9WuML9h2I2S5CyrqQs/lMpIbQ2qHy
zS/c4euSDZY27la/Yd0sejiSvgsi8MPueo4kBvdRvJ6P+qkjnuuf786j1rzCfLt8
Z/oMIOF2J+EIPOwD8HfCU362LMyWXttUXSlQxTyZTYx2xFgyR0vUKvqJB/TM045V
4zbqd/05K64cndcwxrMDgLtvYLb9TL5Iy6KEVXjwiYqzmIjgbEnVqT47exm8ZZlF
Nw+8kEj79OvLRJsP0V+BMq78jT+5tjC0J8AqaQ5223Suz8E6D8KVb7j2bT9X1tBT
RXgLrN1ckTYPZWdPqcLon3j8WhyfA4Mh05joXbDkHaRwv5wzcJjmj/yowvg8rZre
GFMv32WsW73neHaNezglS5MrkbPGoE1DHxooZetFDAxvnoZimwCRBiTVFXe1CxBn
dNYgHOUCO3VJiXNaHux75x4wN2kUgaIAWrreP5zfWGvJgHS6ytZAM7hO3f8g2VZN
Ul8Ovdb/udpGtXugHKFyDTXSyvgR/JSSe40waIzolH6n+NwWgsPcX1XaBrfo5hcE
d+TTibG0VvtJMRo0UFtEaTZIh2LnRhhaJTHiqAvCaU09WNfD8qqz5rq+grqnolVV
EIptnljixwmnOxkRS9oZOoUxaidnEx8TU/0nOlA+SxwuLXehKiuwktzgPMgbPEjV
Pl9ApEkQdmDDgQ==
=0+sN
-----END PGP SIGNATURE-----