extract table headings along with table contents #1011
-
hi, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @poojitharamachandra; thanks for your interest in this library. There's no built-in automated functionality for what you describe, because the logic ends up being quite custom to the particular layout and structure of any given PDF. But the general idea would be to use |
Beta Was this translation helpful? Give feedback.
-
is there a way to extract the section headings under which a particular table is present in the pdf? |
Beta Was this translation helpful? Give feedback.
Hi @poojitharamachandra; thanks for your interest in this library. There's no built-in automated functionality for what you describe, because the logic ends up being quite custom to the particular layout and structure of any given PDF. But the general idea would be to use
page.find_tables()
to find the tables on a page; each table's.bbox
property will give you its coordinates, which you can use along withpage.crop((x0, top, x1, bottom)).extract_text()
to select an area above the table (perhaps optionally withpage.filter(...)
, depending on what else is in that area), with those coordinates determined by you based on the spacing between the table and its heading.