-
Notifications
You must be signed in to change notification settings - Fork 661
Closed
Labels
Description
Description of the bug
Not sure if this is a bug; I worked around it by drawing a white rectangle. It feels a bit surprising.
new_page is documented as producing an empty page (I use it to add empty pages in front of an existing PDF). Nevertheless, using them in show_pdf_page fails.
How to reproduce the bug
import fitz
src_doc = fitz.open()
blank = src_doc.new_page(width=595, height=842)
target_doc = fitz.open()
page = target_doc.new_page(width=595, height=842)
page.show_pdf_page(fitz.Rect(0, 0, 595, 842), blank.parent, blank.number)Result:
Traceback (most recent call last):
File "/home/sliedes/proj/imposition/bug.py", line 12, in <module>
page.show_pdf_page(fitz.Rect(0, 0, 595, 842), blank.parent, blank.number)
File "/home/sliedes/proj/imposition/.venv/lib/python3.12/site-packages/pymupdf/utils.py", line 178, in show_pdf_page
raise ValueError("nothing to show - source page empty")
ValueError: nothing to show - source page empty
PyMuPDF version
1.26.0
Operating system
Linux
Python version
3.12