You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an attempt is made to pass a link to the insert_link method pointing to the last page in a document, an error message is returned and the program exits. This problem is caused by an off-by-one error. The fitz.Document numbering of fitz.Page objects is 0-based, while the numbering used by pdf readers is 1-based. The problem is solved by changing the following lines in the getLinkText function in the utils.py file:
The two occurences of the line
if lnk["page"] >= 0:
should be changed to
if lnk["page"] >= 1:
The line
pno = lnk["page"]
should be changed to
pno = lnk["page"] - 1
The fix was tested and is working correctly.
How to reproduce the bug
How to reproduce the bug:
Attempt to pass a valid link to the insert_link() method pointing to the last page in a pdf document. The method will return an error message and the program will terminate.
PyMuPDF version
1.23.7
Operating system
Windows
Python version
3.9
The text was updated successfully, but these errors were encountered:
Description of the bug
When an attempt is made to pass a link to the insert_link method pointing to the last page in a document, an error message is returned and the program exits. This problem is caused by an off-by-one error. The fitz.Document numbering of fitz.Page objects is 0-based, while the numbering used by pdf readers is 1-based. The problem is solved by changing the following lines in the getLinkText function in the utils.py file:
The two occurences of the line
if lnk["page"] >= 0:
should be changed to
if lnk["page"] >= 1:
The line
pno = lnk["page"]
should be changed to
pno = lnk["page"] - 1
The fix was tested and is working correctly.
How to reproduce the bug
How to reproduce the bug:
Attempt to pass a valid link to the insert_link() method pointing to the last page in a pdf document. The method will return an error message and the program will terminate.
PyMuPDF version
1.23.7
Operating system
Windows
Python version
3.9
The text was updated successfully, but these errors were encountered: