Skip to content

get_textpage_ocr(full=False) OCRs vector graphics, producing garbage words #5064

Description

@tenghian

Description of the bug

Since the 1.27.2 change ("partial OCR now also OCRs vector graphics, not just images"), full=False runs Tesseract on any region MuPDF classifies as "no legible text"

ar2024_unknow_unicode.pdf

How to reproduce the bug

`
tp = page.get_textpage()

    if _UNKNOWN_UNICODE in page.get_text("text", textpage=tp):
        tp_ocr = page.get_textpage_ocr(flags=3, language='eng', dpi=300, full=False, tessdata=tessdata)
        word_blocks = page.get_text("words", flags=flags, textpage=tp_ocr)

`

PyMuPDF version

1.28.0

Operating system

Windows

Python version

3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    not a bugnot a bug / user error / unable to reproduce

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions