From 7e9292c30ed445ac7eb3132914e7e3b4c7df0645 Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Sun, 6 Aug 2023 09:30:53 +0200 Subject: [PATCH] BUG: Fix AnnotationBuilder.link (#2066) 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