Closed nsklei closed 1 month ago
This post cannot be accepted as a bug report because no reproducer file is provided.
MuPDF bug report: https://bugs.ghostscript.com/show_bug.cgi?id=708032.
@nsklei - You are aware that all pages only contain images - no text, no vector graphics. So your redactions effectively are no-ops!
Thank you for reviewing my issue and creating a bug report. The described behaviour in your bug report is correct. I am aware, that all pages only contain images and nothing else, so the redactions should indeed be no-ops in this case.
I found that removing page rotation avoids the problem:
for page in doc:
page.add_redact_annot(page.rect * page.derotation_matrix)
page.remove_rotation()
page.apply_redactions(images=pymupdf.PDF_REDACT_IMAGE_NONE)
Works without problem.
Thank you for providing a solution to my problem. I tested your suggestion and it works perfectly :)
Thanks for the feedback! I am going to re-open this until the fix itself is publicly available. This is our policy for dealing with issue resolutions.
@JorjMcKie This appears to have been fixed upstream, so can be marked "fix developed"?
Fixed in 1.24.11.
Description of the bug
When using apply_redactions(images=pymupdf.PDF_REDACT_IMAGE_NONE) I get several "MuPDF error: syntax error: cannot find XObject resource" errors and as well there are some pages which are completely empty, altough all pages originally contain images.
How to reproduce the bug
The code above prints the following information:
As you can see, each page contains two images. The function should remove all content from the PDF file except the images. But when saving the byte_stream there are some pages completely empy.
PyMuPDF version
1.24.10
Operating system
Windows
Python version
3.12