Skip to content

Removing text from every page of a PDF #2489

Answered by stefan6419846
j-t-1 asked this question in Q&A
Discussion options

You must be logged in to vote

The above code is not working; is there an obvious fault or a better way?

What do you mean by "not working"? Please note that just moving the box does not guarantee that the text will disappear, but maybe just hide it.

Can the text be removed directly (something like deflate the PDF, then view it to see which object contains the text, then deleting the references)?

This highly depends on the PDF itself, although it generally should be doable if the PDF file has a valid text layer. You probably want to have a look at page.get_contents and page.replace_contents for this.

Replies: 2 comments 19 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by stefan6419846
Comment options

You must be logged in to vote
19 replies
@pubpub-zz
Comment options

@j-t-1
Comment options

@j-t-1
Comment options

@stefan6419846
Comment options

@j-t-1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants