Skip to content
Discussion options

You must be logged in to vote

1-char searches are always problematic of course, because characters in a row may have tiny overlaps (created by the PDF maker). What you always do in similar cases is this:

fitz.TOOLS.set_small_glyph_heights(True)
True
rl=page.search_for("9")
for r in rl:
    page.get_textbox(r)

    
'99'
'99'
'r\n9'
'9'
'9'
'9'
'99'
'99'

The second hickup: if the search algorithm finds multiple adjacent copies of the needle, then one common rectangle is returned as visible above.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@JorjMcKie
Comment options

Answer selected by Carnegie-eng
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
Category
Q&A
Labels
None yet
2 participants