Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Annotations Creating a White Space #4733

Discussion options

Hi, I see people have had this issue before, referencing #4709

When I run add_redact_annot it creates a whitespace that I am not sure how to get rid of. I tried the solution in the discussion that I referenced but I was not able to get it to work. Any suggestions?

image
for page in pdf:
 for attr in pdf_content:
 translations = attr[0] 
 font = self.font_validator(attr[1])
 size = attr[2]
 color = self.color_validator(attr[3])
 bbox = attr[4]
 page.add_redact_annot(bbox,text=translations, fontname=font, fontsize=size, text_color=color)
 page.apply_redactions(images=pymupdf.PDF_REDACT_IMAGE_NONE,graphics=pymupdf.PDF_REDACT_LINE_ART_NONE) 
You must be logged in to vote

It does not create a white space - it leaves a gap!
There is no way to avoid this: please recall that a PDF is not a Word document, where remaining content is reshuffled after deletion.

The referenced discussion had a different, self-created the problem. If you allow defaults in .apply_redactions() then more than just the text is being removed: If there was an overlapping image, then that will show a punched-out hole, any overlapping vector graphics will be completely removed ...

Replies: 1 comment 1 reply

Comment options

It does not create a white space - it leaves a gap!
There is no way to avoid this: please recall that a PDF is not a Word document, where remaining content is reshuffled after deletion.

The referenced discussion had a different, self-created the problem. If you allow defaults in .apply_redactions() then more than just the text is being removed: If there was an overlapping image, then that will show a punched-out hole, any overlapping vector graphics will be completely removed ...

You must be logged in to vote
1 reply
Comment options

Ok that makes sense. Thank you

Answer selected by NasGit99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /