Skip to content
Discussion options

You must be logged in to vote

To also erase a word following one of the found keywords, you could take a hit rect, enlarge it until the right page border, extract the words inside the result.
This should give you a list of words, where the first is the "password" literal and the second is (hopefully) the password itself.
The take the rectangle of that second item and join it with the hit rectangle to make a common redaction for both, or simple create another redact annot for the second item.
Like that (r being a hit rect of the search):

temp = +r  # copy of r
temp.x1=page.rect.width  # extend to page border
words = page.get_text("words", clip=temp)
pw = words[1]  # the password item itself like (x0, y0, x1, y1, "secre…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@JorjMcKie
Comment options

@JorjMcKie
Comment options

Answer selected by danilyef
@danilyef
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants