File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 66
66
ArrayObject ,
67
67
ContentStream ,
68
68
DecodedStreamObject ,
69
+ Destination ,
69
70
DictionaryObject ,
70
71
EncodedStreamObject ,
71
72
IndirectObject ,
75
76
PdfObject ,
76
77
StreamObject ,
77
78
TextStringObject ,
79
+ TreeObject ,
78
80
is_null_or_none ,
79
81
read_object ,
80
82
)
@@ -138,6 +140,8 @@ def __init__(
138
140
elif password is not None :
139
141
raise PdfReadError ("Not an encrypted file" )
140
142
143
+ self ._named_destinations_cache : Optional [dict [str , Destination ]] = None
144
+
141
145
def _initialize_stream (self , stream : Union [StrByteType , Path ]) -> None :
142
146
if hasattr (stream , "mode" ) and "b" not in stream .mode :
143
147
logger_warning (
@@ -1274,3 +1278,18 @@ def _repr_mimebundle_(
1274
1278
data = {k : v for k , v in data .items () if k not in exclude }
1275
1279
1276
1280
return data
1281
+
1282
+ def _get_named_destinations (
1283
+ self ,
1284
+ tree : Union [TreeObject , None ] = None ,
1285
+ retval : Optional [dict [str , Destination ]] = None ,
1286
+ ) -> dict [str , Destination ]:
1287
+ """Override from PdfDocCommon. In the reader we can assume this is
1288
+ static, but not in the writer.
1289
+ """
1290
+ if tree or retval :
1291
+ return PdfDocCommon ._get_named_destinations (self , tree , retval )
1292
+
1293
+ if self ._named_destinations_cache is None :
1294
+ self ._named_destinations_cache = PdfDocCommon ._get_named_destinations (self )
1295
+ return self ._named_destinations_cache
You can’t perform that action at this time.
0 commit comments