Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Adding get_bounding_box property #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions camelot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,23 @@ def parsing_report(self):
"page": self.page,
}
return report

@property
def get_bounding_box(self) -> Cell:
"""Get Cell containing bounding box for entire table"""
bounding_box = self.cells[0][0]
for row in self.cells:
for cell in row:
if bounding_box.x1 > cell.x1:
bounding_box.x1 = cell.x1
if bounding_box.y1 > cell.y1:
bounding_box.y1 =cell.y1
if bounding_box.x2 < cell.x2:
bounding_box.x2 = cell.x2
if bounding_box.y2 < cell.y2:
bounding_box.y2 = cell.y2

return bounding_box

def set_all_edges(self):
"""Sets all table edges to True."""
Expand Down
Loading