Skip to content

page.apply_redactions gives unwanted black rectangle #3630

Closed
@CH-Tam

Description

@CH-Tam

Description of the bug

I want to remove all texts and only keep vector graphics (such as straight lines) in PDF, the code and result are shown below.

However, the original PDF does not contain that black rectangle, the output is undesired. What should I do? (the PDF file is non-public, but it can be provided though private channels.)

Both 1.24.3 and 1.24.7 have this error.

How to reproduce the bug

        doc = fitz.open(pdf_path)
                for page in doc:
                    page.add_redact_annot(page.rect + (-600, -600, 600, 600))
                    page.apply_redactions(graphics=0)

The result of 1st page is
image

PyMuPDF version

1.24.7

Operating system

Linux

Python version

3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    fix developedrelease schedule to be determinedupstream bugbug outside this package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions