-
Notifications
You must be signed in to change notification settings - Fork 678
Closed
Description
Description of the bug
Dear JorjMcKie,
I am currently working with a PDF document that contains text, and I have encountered a challenge. When I use the page.insert_image function to insert an image into the PDF, the new image overlays the existing text. However, my goal is to have the image appear beneath the text, ensuring the text remains visible.
I have searched the documentation but have not found a method to detect when text is covered by an image or to adjust the layering order during the insertion process. Could you please advise if there is a way to achieve this, or if there is any functionality in the library that I might have overlooked?
Thank you for your time and assistance.
How to reproduce the bug
for rect_index, rect in enumerate(image_rect, start=0):
print(rect_index, rect)
image_xref = page.insert_image(
image_rect[rect_index],
stream=compressed_base_image_bytes,
mask=compressed_mask_image_bytes,
xref=image_xref,
)
page.apply_redactions(pymupdf.PDF_REDACT_IMAGE_NONE)
PyMuPDF version
1.24.7
Operating system
MacOS
Python version
3.11
Metadata
Metadata
Assignees
Labels
No labels
