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 6666 ArrayObject ,
6767 ContentStream ,
6868 DecodedStreamObject ,
69+ Destination ,
6970 DictionaryObject ,
7071 EncodedStreamObject ,
7172 IndirectObject ,
7576 PdfObject ,
7677 StreamObject ,
7778 TextStringObject ,
79+ TreeObject ,
7880 is_null_or_none ,
7981 read_object ,
8082)
@@ -138,6 +140,8 @@ def __init__(
138140 elif password is not None :
139141 raise PdfReadError ("Not an encrypted file" )
140142
143+ self ._named_destinations_cache : Optional [dict [str , Destination ]] = None
144+
141145 def _initialize_stream (self , stream : Union [StrByteType , Path ]) -> None :
142146 if hasattr (stream , "mode" ) and "b" not in stream .mode :
143147 logger_warning (
@@ -1274,3 +1278,18 @@ def _repr_mimebundle_(
12741278 data = {k : v for k , v in data .items () if k not in exclude }
12751279
12761280 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