Replies: 2 comments 8 replies
-
There is a solution to this, but let me first move this to the "Discussions" tab. |
Beta Was this translation helpful? Give feedback.
-
I assume you have used the lower rectangle produced after The reason for this effect is the logic behind the redaction algorithm (inside MuPDF code): it is based on characters overlapping redaction rectangles - as opposed to characters being contained. If the PDF creator was unfortunate enough choosing line distances much smaller than the font's natural one, there will always be pesky situations like yours. Shrinking your redaction rect (height) even more will however do the trick. Your redaction rect can be as small as you want, it doesn't need to cover the word "von". For example, reduce its height by 20% from its top and its bottom: delta = rect.height * 0,2
page.add_redact_annot(rect + (0,delta,0,-delta)) |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm facing a strange issue when i apply redaction on a PDF.
I have the following text:
in my experiment i redact the word "von", which overlaps with bbox of the word "Niederschrift" below it and erases some of its letters, as shown below:
In one of your github issues I saw you recommended using
fitz.TOOLS.set_small_glyph_heights(True)
, which updated the bboxes and they are not overlapping anymore.However, when i apply redaction to the word "von" it still erases the word below.
I'm suspecting that apply_redactions() isn't just operating on the bbox rectangle, but can't really say for sure. bbox coords of those words do not overlap at all
Could you please help with this ?
Beta Was this translation helpful? Give feedback.
All reactions