From a9f9513b151b345cb8fdc596099e0a39dfc9f7fe Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Wed, 27 Mar 2024 14:22:25 +0200 Subject: [PATCH] fixup! FIXUP: Handle different PyMuPDF versions --- dangerzone/isolation_provider/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dangerzone/isolation_provider/base.py b/dangerzone/isolation_provider/base.py index 26d40a646..e761c23b5 100644 --- a/dangerzone/isolation_provider/base.py +++ b/dangerzone/isolation_provider/base.py @@ -101,7 +101,7 @@ def convert( self.print_progress(document, True, str(e), 0) document.mark_as_failed() - def _ocr_page(self, pixmap: fitz.Pixmap, ocr_lang: str) -> bytes: + def ocr_page(self, pixmap: fitz.Pixmap, ocr_lang: str) -> bytes: """Get a single page as pixels, OCR it, and return a PDF as bytes. This operation is particularly tricky, since we have to handle various PyMuPDF @@ -164,7 +164,7 @@ def _pixels_to_pdf( pixmap.set_dpi(DEFAULT_DPI, DEFAULT_DPI) if ocr_lang: # OCR the document - page_pdf_bytes = self._ocr_page(pixmap, ocr_lang) + page_pdf_bytes = self.ocr_page(pixmap, ocr_lang) else: # Don't OCR page_doc = fitz.Document() page_doc.insert_file(pixmap)