Skip to content
Discussion options

You must be logged in to vote

I know after a certain hit I can go and get a specific value.

Ok, got you.
You may have a couple of problems though:

  • The actual invoice number may not exactly fit in the same y0/y1 stripe: there always are these uncertainties
  • the distance between your keyword rect end and the start of the desired value may be blurry / not always exact

Why dont you do enlarge you hit rect of "invoice number" by some amount. Assuming rect is that hit rect, do something like this:

rect.y0 -= 5  # make the stripe higher
rect.y1 += 5
rect.x1 = page.rect.width # go until right page border
words = page.get_text("words", clip=rect, sort=True)  # ensure left-to-right sorting order
# now items 0 and 1 should re…

Replies: 2 comments 4 replies

Comment options

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

@sdezza
Comment options

@JorjMcKie
Comment options

Comment options

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

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