Skip to content

Commit

Permalink
Merge pull request #1169 from dhdaines/struct_follow_refs
Browse files Browse the repository at this point in the history
fix: dereference structure element attributes
  • Loading branch information
jsvine authored Jul 14, 2024
2 parents 937702d + 3f16180 commit fc1e671
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pdfplumber/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,13 @@ def _make_element(self, obj: Any) -> Tuple[Optional[PDFStructElement], List[Any]
children = [obj["K"]]
revision = obj.get("R")
attributes = self._make_attributes(obj, revision)
element_id = decode_text(obj["ID"]) if "ID" in obj else None
title = decode_text(obj["T"]) if "T" in obj else None
lang = decode_text(obj["Lang"]) if "Lang" in obj else None
alt_text = decode_text(obj["Alt"]) if "Alt" in obj else None
actual_text = decode_text(obj["ActualText"]) if "ActualText" in obj else None
element_id = decode_text(resolve1(obj["ID"])) if "ID" in obj else None
title = decode_text(resolve1(obj["T"])) if "T" in obj else None
lang = decode_text(resolve1(obj["Lang"])) if "Lang" in obj else None
alt_text = decode_text(resolve1(obj["Alt"])) if "Alt" in obj else None
actual_text = (
decode_text(resolve1(obj["ActualText"])) if "ActualText" in obj else None
)
element = PDFStructElement(
type=obj_tag,
id=element_id,
Expand Down

0 comments on commit fc1e671

Please sign in to comment.