Remove text from a PDF #3049
-
Hi! Is there an efficient way to remove/delete all text from a PDF with pypdf? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
To remove all text which is based upon regular text operations, use Removing all text of a specific font requires a custom implementation and more effort - see the internal implementation of |
Beta Was this translation helpful? Give feedback.
To remove all text which is based upon regular text operations, use
writer.remove_text()
: https://pypdf.readthedocs.io/en/stable/modules/PdfWriter.html#pypdf.PdfWriter.remove_textRemoving all text of a specific font requires a custom implementation and more effort - see the internal implementation of
writer.remove_objects_from_page()
for howwriter.remove_text()
works. An advanced implementation would have to look into the font definitions as well.