From 63032d304d9076c748fcc960fe3203650c69d890 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 10 May 2018 16:27:17 -0700 Subject: [PATCH] Revert "Since PyMuPDF 1.13.3 corrupts text, pin 1.12.5 and work around it" This reverts commit b0ce7c63dd27257d9c979fde9013243b8ae38c98. --- setup.py | 2 +- src/ocrmypdf/pdfinfo.py | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index ccb85522..ab634951 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.12.5'], + 'fitz': ['PyMuPDF >= 1.13.3'], }, tests_require=tests_require, entry_points={ diff --git a/src/ocrmypdf/pdfinfo.py b/src/ocrmypdf/pdfinfo.py index cf6ff54c..aafa69da 100644 --- a/src/ocrmypdf/pdfinfo.py +++ b/src/ocrmypdf/pdfinfo.py @@ -586,12 +586,7 @@ def _page_get_textblocks(infile, pageno): "Smarter text detection" doc = fitz.Document(infile) - if fitz.version[0] >= '1.13.0': - text = doc[pageno].getText('dict') - else: - import json - textjson = doc[pageno].getText('json') - text = json.loads(textjson) + text = doc[pageno].getText('dict') if not text: return