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
Hi, there.
Here's the situation: I'm trying to hide certain content in a PDF, so I used the following code. It seems like the code can only handle PDF files with one page, as it throws an error similar to the one mentioned above when dealing with more than one page.
from __future__ importprint_functionimportfitz, syssrc=fitz.open(sys.argv[1])
doc=fitz.open()
forspageinsrc:
r=spage.rectredact_area=fitz.Rect(100, 100, 200, 200)
spage.add_redact_annot(redact_area)
spage.apply_redactions() # clears areas to excludepage=doc.new_page(-1, width=r.width, height=r.height)
page.show_pdf_page(
page.rect,
src,
spage.number,
clip=r,
)
doc.save("output.pdf", garbage=4, deflate=True)
The code runs without errors if I comment out these two lines:
spage.add_redact_annot((0, 0, 100, 100))
spage.apply_redactions() # clears areas to exclude
How to reproduce the bug
Any PDF file can be used to test the error code. I've tried several versions of PyMuPDF, and they all have this problem. problem.pdf No_problem.pdf
PyMuPDF version
1.24.2
Operating system
MacOS, Linux
Python version
3.11, 3.8
The text was updated successfully, but these errors were encountered:
Description of the bug
Hi, there.
Here's the situation: I'm trying to hide certain content in a PDF, so I used the following code. It seems like the code can only handle PDF files with one page, as it throws an error similar to the one mentioned above when dealing with more than one page.
The code runs without errors if I comment out these two lines:
How to reproduce the bug
Any PDF file can be used to test the error code. I've tried several versions of PyMuPDF, and they all have this problem.
problem.pdf
No_problem.pdf
PyMuPDF version
1.24.2
Operating system
MacOS, Linux
Python version
3.11, 3.8
The text was updated successfully, but these errors were encountered: