How could we get the higlighted portion, quad (quad_like,rect_like) from page object ? #2381
Answered
by
JorjMcKie
Carnegie-eng
asked this question in
Q&A
-
I would like to get the position information on highlited portion in page of PDF document. example: I can't look for the information on highlighted portion from page object above. Where does the informtion exited in the page object ? |
Beta Was this translation helpful? Give feedback.
Answered by
JorjMcKie
May 1, 2023
Replies: 1 comment 2 replies
-
You can walk over the highlight annotations of the page, then take every of their rectangles and see what's underneath. for annot in page.annots(types=[fitz.PDF_ANNOT_HIGHLIGHT]):
rect = annot.rect + (-5, -5, 5, 5) # annot rect, 5 points larger in every direction
print("highlighted:", page.get_textbox(rect)) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Carnegie-eng
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can walk over the highlight annotations of the page, then take every of their rectangles and see what's underneath.