-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZeroDivisionError: float division by zero with page.apply_redactions() #3561
Comments
For whatever reason, some of your |
Thanks ! |
The success of text searching is dependent on that text is indeed stored in a searchable way. That may not be the case at all! Even if a page looks utterly harmless. For a demo look at these two files, file1, file2. Both look exactly equal - and in fact, every character is positioned at the exact same place in both of them. doc1=pymupdf.open("textmaker.pdf")
doc2=pymupdf.open("textmaker2.pdf")
page1 = doc1[0]
page2 = doc2[0]
needle = "alignment." # some text to search for
page1.search_for(needle)
[Rect(205.07913208007812, 158.3671875, 257.65399169921875, 172.76171875),
Rect(91.0791244506836, 158.3671875, 143.65399169921875, 172.76171875)]
page2.search_for(needle)
[] You will never find any word in file2, however, single characters are no problem. Text searching contains no precaution to extract single characters and sort them in "natural reading sequence" (what is that anyway?) before finally searching for something. The performance of such an approach would make it unattractive. |
Ok, I got it, very clear. Thanks ! |
Fixed in 1.24.6. |
Description of the bug
Issue #2943 seems still there in version 1.24.5
Here's the code involved :
Am I doing something wrong maybe ?
Thanks a lot
How to reproduce the bug
PyMuPDF version
1.24.5
Operating system
MacOS
Python version
3.9
The text was updated successfully, but these errors were encountered: