@@ -2714,3 +2714,33 @@ def test_merge__process_named_dests__no_dests_in_source_file():
2714
2714
assert writer .named_destinations == {
2715
2715
"test.pdf" : Destination (title = "test.pdf" , page = writer .pages [1 ].indirect_reference , fit = Fit ("/Fit" ))
2716
2716
}
2717
+
2718
+
2719
+ def test_insert_filtered_annotations__link_without_destination ():
2720
+ """Test for #3211"""
2721
+ writer = PdfWriter (clone_from = RESOURCE_ROOT / "crazyones.pdf" )
2722
+ reader = PdfReader (RESOURCE_ROOT / "hello-world.pdf" )
2723
+
2724
+ annotations = [
2725
+ DictionaryObject ({
2726
+ "/A" : DictionaryObject ({"/S" : NameObject ("/GoTo" ), "/D" : None }),
2727
+ "/BS" : {"/S" : "/S" , "/Type" : "/Border" , "/W" : 0 },
2728
+ "/Border" : [0 , 0 , 0 ],
2729
+ "/H" : "/I" ,
2730
+ "/Rect" : [68.6001 , 653.405 , 526.2 , 671.054 ],
2731
+ "/StructParent" : 9 ,
2732
+ "/Subtype" : NameObject ("/Link" ),
2733
+ "/Type" : NameObject ("/Annot" )
2734
+ })
2735
+ ]
2736
+ result = writer ._insert_filtered_annotations (
2737
+ annots = annotations , page = writer .pages [0 ], pages = {}, reader = reader
2738
+ )
2739
+ assert result == []
2740
+
2741
+ writer = PdfWriter (clone_from = RESOURCE_ROOT / "crazyones.pdf" )
2742
+ del annotations [0 ]["/A" ]["/D" ]
2743
+ result = writer ._insert_filtered_annotations (
2744
+ annots = annotations , page = writer .pages [0 ], pages = {}, reader = reader
2745
+ )
2746
+ assert result == []
0 commit comments