Skip to content

Unexpected result for apply_redactions() #4079

Closed
@slevin1994

Description

@slevin1994

Description of the bug

My pymupdf version is 1.24.14.
I tried invoke add_redact_annot(rect) and apply_redactions(images=0) to remove some words from original pdf file. The locations are shown as below:
image

However words remanins in these rect areas. Meanwhile some other words were removed unexpectly. The result is shown
as below:
image

I also attached the files mentioned above, along with the rect positions.

original pdf file: redactions_error_sample.pdf

result file after add_redact_annot(rect):
before_apply_redactions.pdf

result after apply_redactions(images=0):
after_apply_redactions.pdf

rect areas: [{"rect":[164,213,282,227]},{"rect":[282,213,397,233]},{"rect":[434,209,525,243]},{"rect":[169,228,231,243]},{"rect":[377,592,440,607]},{"rect":[373,611,444,626]}]

How to reproduce the bug

doc = fitz.open("redactions_error_sample.pdf")
page = doc.load_page(0)
for rect in rects:
  page.add_redact_annot(rect)
doc.save("before_apply_redactions.pdf")
page.apply_redactions(images=0)
doc.save("after_apply_redactions.pdf")

PyMuPDF version

1.24.14

Operating system

MacOS

Python version

3.9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions