Skip to content

Commit

Permalink
fixup! FIXUP: Handle different PyMuPDF versions
Browse files Browse the repository at this point in the history
  • Loading branch information
apyrgio committed Mar 27, 2024
1 parent faab460 commit a9f9513
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dangerzone/isolation_provider/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a9f9513

Please sign in to comment.