Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions unstructured/partition/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,10 @@ def _pdfminer_page_elements(
page_number,
annotation_threshold,
)
_, words = get_words_from_obj(obj, height)
for annot in annotations_within_element:
urls_metadata.append(map_bbox_and_index(words, annot))
if annotations_within_element:
_, words = get_words_from_obj(obj, height)
for annot in annotations_within_element:
urls_metadata.append(map_bbox_and_index(words, annot))

if hasattr(obj, "get_text"):
# Use deduplication to handle fake bold text (characters rendered twice)
Expand Down
7 changes: 4 additions & 3 deletions unstructured/partition/pdf_image/pdfminer_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,10 @@ def process_page_layout_from_pdfminer(
page_number,
annotation_threshold,
)
_, words = get_words_from_obj(obj, page_height)
for annot in annotations_within_element:
urls_metadata.append(map_bbox_and_index(words, annot))
if annotations_within_element:
_, words = get_words_from_obj(obj, page_height)
for annot in annotations_within_element:
urls_metadata.append(map_bbox_and_index(words, annot))

if hasattr(obj, "get_text"):
inner_text_objects = extract_text_objects(obj)
Expand Down
Loading