Skip to content

PyMuPDF==1.24.0 will hanging when using page.get_text("text") #3357

@xiaominghero

Description

@xiaominghero

Description of the bug

os: linux Ubuntu 22.04 LTS
python 3.10.2

When I upload a PDF file, the program hangs for several hours without exiting When using get_text() method.

image

How to reproduce the bug

>>> import fitz as pymupdf
>>> pdf_path = '/data/dataset/book/pdf/bad/e4a0626f933941c6db3257f5cea4f3e5.pdf'
>>> def parse_test(pdf_path) -> str:
...     pymu_doc = pymupdf.open(pdf_path, filetype="pdf")
...     contents = []
...     try:
...         if not pymu_doc:
...             return contents
...         for _, page in enumerate(pymu_doc):
...             content = page.get_text("text")
...             contents.append(content.replace('\n', ' '))
...     except Exception:
...         contents = []
...     return '\n'.join(contents)
...
>>> a = parse_test(pdf_path)

e4a0626f933941c6db3257f5cea4f3e5.pdf

PyMuPDF version

1.24.0

Operating system

Linux

Python version

3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    fix developedrelease schedule to be determinedupstream bugbug outside this package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions