diff --git a/setup.py b/setup.py index ab634951..ccb85522 100644 --- a/setup.py +++ b/setup.py @@ -251,7 +251,7 @@ setup( 'ruffus == 2.6.3', # pinned - ocrmypdf implements a 2.6.3 workaround ], extras_require={ - 'fitz': ['PyMuPDF >= 1.13.3'], + 'fitz': ['PyMuPDF == 1.12.5'], }, tests_require=tests_require, entry_points={ diff --git a/src/ocrmypdf/pdfinfo.py b/src/ocrmypdf/pdfinfo.py index aafa69da..cf6ff54c 100644 --- a/src/ocrmypdf/pdfinfo.py +++ b/src/ocrmypdf/pdfinfo.py @@ -586,7 +586,12 @@ def _page_get_textblocks(infile, pageno): "Smarter text detection" doc = fitz.Document(infile) - text = doc[pageno].getText('dict') + if fitz.version[0] >= '1.13.0': + text = doc[pageno].getText('dict') + else: + import json + textjson = doc[pageno].getText('json') + text = json.loads(textjson) if not text: return