From c887402e5b2c8e9fd015af767070d3686bd8c8fa Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Sun, 6 Aug 2023 09:13:18 +0200 Subject: [PATCH] BUG: Fix AnnotationBuilder.link The object was not updating itself, but a temporary variable in it Closes #2058 --- pypdf/annotations/_markup_annotations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pypdf/annotations/_markup_annotations.py b/pypdf/annotations/_markup_annotations.py index 76ca5439d..e4233412d 100644 --- a/pypdf/annotations/_markup_annotations.py +++ b/pypdf/annotations/_markup_annotations.py @@ -331,7 +331,7 @@ def __init__( else: border_arr = [NumberObject(0)] * 3 - link_obj = DictionaryObject( + self.update( { NameObject("/Type"): NameObject("/Annot"), NameObject("/Subtype"): NameObject("/Link"), @@ -340,7 +340,7 @@ def __init__( } ) if is_external: - link_obj[NameObject("/A")] = DictionaryObject( + self[NameObject("/A")] = DictionaryObject( { NameObject("/S"): NameObject("/URI"), NameObject("/Type"): NameObject("/Action"), @@ -356,4 +356,4 @@ def __init__( "fit_args": fit.fit_args, } ) - link_obj[NameObject("/Dest")] = dest_deferred + self[NameObject("/Dest")] = dest_deferred