Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page.apply_redactions gives unwanted black rectangle #3630

Closed
CH-Tam opened this issue Jun 27, 2024 · 5 comments
Closed

page.apply_redactions gives unwanted black rectangle #3630

CH-Tam opened this issue Jun 27, 2024 · 5 comments
Labels
fix developed release schedule to be determined upstream bug bug outside this package

Comments

@CH-Tam
Copy link

CH-Tam commented Jun 27, 2024

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

@JorjMcKie
Copy link
Collaborator

Please send me the file via e-mail, thanks.

@JorjMcKie
Copy link
Collaborator

@CH-Tam - I received nothing so far ... did you use jorj.x.mckie@outlook.de?

@JorjMcKie
Copy link
Collaborator

JorjMcKie commented Jun 27, 2024

Thanks - file received.
This is a problem in the base library for which a fix has been developed.
I tested it locally with the improvements and confirmed that it works.

The fix works with MuPDF v1.25.0. (the development version on GitHub).

@JorjMcKie JorjMcKie added upstream bug bug outside this package fix developed release schedule to be determined labels Jun 27, 2024
@JorjMcKie
Copy link
Collaborator

This has been fixed by a recent release - probably already 1.24.10.

@CH-Tam
Copy link
Author

CH-Tam commented Oct 8, 2024

hi @JorjMcKie, I have tried the new versions (1.24.10 & 1.24.11).
In 1.24.10, the issue is completely solved; however in 1.24.11, the above code has no impact at all (cannot clear the text in the PDF).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix developed release schedule to be determined upstream bug bug outside this package
Projects
None yet
Development

No branches or pull requests

2 participants