Replies: 4 comments
-
This is a very common thing: What can you do?
Please consult the documentation here: https://pymupdf.readthedocs.io/en/latest/textpage.html#span-dictionary for a detailed description. |
Beta Was this translation helpful? Give feedback.
-
Oops, sorry I responded without reading your full post! |
Beta Was this translation helpful? Give feedback.
-
Example calculation: delta = fitz.Point(0, rect.height) * 0.2
new_rect = fitz.Rect(rect.tl + delta, rect.br - delta) Then new_rect will have the same horizontal middle line and width as rect, but only 60% of rect's height. |
Beta Was this translation helpful? Give feedback.
-
An interesting question might be, how to detect this type of situation beforehand - so the remedy only needs to be applied in that case. One way is to check whether line bboxes overlap. Maybe there is even a constant percentage of those overlaps wrt line height. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a problem with Pymupdf redaction. The issue is basically some of the text around the annotated part is also deleted when apply redaction. You can see the example below:
After redaction, it will become:
I follow the instruction to use
fitz.TOOLS.set_small_glyph_heights(on=True)
and get the following result:This time the annotated part has been smaller, but still the result is not as I expected:
I get the quads annotations from page.search_for() and add the redaction with page.add_redact_annot().
The code is as below:
Is there anyway to improve this?
And by the way, some of us use Adobe Reader tool to add the annotation manually. Those annotations could not be "squeeze", so the surrounding text is removed unwantedly.
The example below is an annotation made by Adobe Reader Comment tool.
On the Pymupdf it says: "Text removal is done by character: A character is removed if its bbox has a non-empty overlap with a redaction rectangle (changed in MuPDF v1.17)". I guess this is the main issue here. Is there anyway get around this with a fix?
Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions