Skip to content
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
5 changes: 4 additions & 1 deletion pypdf/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2129,9 +2129,12 @@ def add_annotation(
# destination
if to_add.get("/Subtype") == "/Link" and "/Dest" in to_add:
tmp = cast(Dict[Any, Any], to_add[NameObject("/Dest")])
# Changes target_page_index an integer to target_page an IndirectObject
pages_obj = cast(Dict[str, Any], self.get_object(self._pages))
target_page = pages_obj[PA.KIDS][tmp["target_page_index"]]
dest = Destination(
NameObject("/LinkName"),
tmp["target_page_index"],
target_page,
Fit(
fit_type=tmp["fit"], fit_args=dict(tmp)["fit_args"]
), # I have no clue why this dict-hack is necessary
Expand Down