@@ -392,37 +392,6 @@ def __exit__(
392
392
if self .fileobj and not self ._cloned :
393
393
self .write (self .fileobj )
394
394
395
- def _repr_mimebundle_ (
396
- self ,
397
- include : Union [None , Iterable [str ]] = None ,
398
- exclude : Union [None , Iterable [str ]] = None ,
399
- ) -> Dict [str , Any ]:
400
- """
401
- Integration into Jupyter Notebooks.
402
-
403
- This method returns a dictionary that maps a mime-type to its
404
- representation.
405
-
406
- .. seealso::
407
-
408
- https://ipython.readthedocs.io/en/stable/config/integrating.html
409
- """
410
- pdf_data = BytesIO ()
411
- self .write (pdf_data )
412
- data = {
413
- "application/pdf" : pdf_data ,
414
- }
415
-
416
- if include is not None :
417
- # Filter representations based on include list
418
- data = {k : v for k , v in data .items () if k in include }
419
-
420
- if exclude is not None :
421
- # Remove representations based on exclude list
422
- data = {k : v for k , v in data .items () if k not in exclude }
423
-
424
- return data
425
-
426
395
@property
427
396
def pdf_header (self ) -> str :
428
397
"""
@@ -3299,6 +3268,37 @@ def _set_page_label(
3299
3268
page_labels [NameObject ("/Nums" )] = nums
3300
3269
self ._root_object [NameObject (CatalogDictionary .PAGE_LABELS )] = page_labels
3301
3270
3271
+ def _repr_mimebundle_ (
3272
+ self ,
3273
+ include : Union [None , Iterable [str ]] = None ,
3274
+ exclude : Union [None , Iterable [str ]] = None ,
3275
+ ) -> Dict [str , Any ]:
3276
+ """
3277
+ Integration into Jupyter Notebooks.
3278
+
3279
+ This method returns a dictionary that maps a mime-type to its
3280
+ representation.
3281
+
3282
+ .. seealso::
3283
+
3284
+ https://ipython.readthedocs.io/en/stable/config/integrating.html
3285
+ """
3286
+ pdf_data = BytesIO ()
3287
+ self .write (pdf_data )
3288
+ data = {
3289
+ "application/pdf" : pdf_data ,
3290
+ }
3291
+
3292
+ if include is not None :
3293
+ # Filter representations based on include list
3294
+ data = {k : v for k , v in data .items () if k in include }
3295
+
3296
+ if exclude is not None :
3297
+ # Remove representations based on exclude list
3298
+ data = {k : v for k , v in data .items () if k not in exclude }
3299
+
3300
+ return data
3301
+
3302
3302
3303
3303
def _pdf_objectify (obj : Union [Dict [str , Any ], str , float , List [Any ]]) -> PdfObject :
3304
3304
if isinstance (obj , PdfObject ):
0 commit comments