File tree Expand file tree Collapse file tree 3 files changed +10
-22
lines changed
Expand file tree Collapse file tree 3 files changed +10
-22
lines changed Original file line number Diff line number Diff line change @@ -1062,11 +1062,13 @@ class Catalog {
10621062 if ( obj instanceof Dict && obj . has ( "XFAImages" ) ) {
10631063 const nameTree = new NameTree ( obj . getRaw ( "XFAImages" ) , this . xref ) ;
10641064 for ( const [ key , value ] of nameTree . getAll ( ) ) {
1065- xfaImages ??= new Dict ( this . xref ) ;
1066- xfaImages . set (
1067- stringToPDFString ( key , /* keepEscapeSequence = */ true ) ,
1068- value
1069- ) ;
1065+ if ( value instanceof BaseStream ) {
1066+ xfaImages ??= new Map ( ) ;
1067+ xfaImages . set (
1068+ stringToPDFString ( key , /* keepEscapeSequence = */ true ) ,
1069+ value . getBytes ( )
1070+ ) ;
1071+ }
10701072 }
10711073 }
10721074 return shadow ( this , "xfaImages" , xfaImages ) ;
Original file line number Diff line number Diff line change @@ -1238,23 +1238,10 @@ class PDFDocument {
12381238 }
12391239
12401240 async loadXfaImages ( ) {
1241- const xfaImagesDict = await this . pdfManager . ensureCatalog ( "xfaImages" ) ;
1242- if ( ! xfaImagesDict ) {
1241+ const xfaImages = await this . pdfManager . ensureCatalog ( "xfaImages" ) ;
1242+ if ( ! xfaImages ) {
12431243 return ;
12441244 }
1245-
1246- const keys = xfaImagesDict . getKeys ( ) ;
1247- const objectLoader = new ObjectLoader ( xfaImagesDict , keys , this . xref ) ;
1248- await objectLoader . load ( ) ;
1249-
1250- const xfaImages = new Map ( ) ;
1251- for ( const key of keys ) {
1252- const stream = xfaImagesDict . get ( key ) ;
1253- if ( stream instanceof BaseStream ) {
1254- xfaImages . set ( key , stream . getBytes ( ) ) ;
1255- }
1256- }
1257-
12581245 this . xfaFactory . setImages ( xfaImages ) ;
12591246 }
12601247
Original file line number Diff line number Diff line change @@ -3412,8 +3412,7 @@ class Image extends StringObject {
34123412 return HTMLResult . EMPTY ;
34133413 }
34143414
3415- let buffer =
3416- this [ $globalData ] . images && this [ $globalData ] . images . get ( this . href ) ;
3415+ let buffer = this [ $globalData ] . images ?. get ( this . href ) ;
34173416 if ( ! buffer && ( this . href || ! this [ $content ] ) ) {
34183417 // In general, we don't get remote data and use what we have
34193418 // in the pdf itself, so no picture for non null href.
You can’t perform that action at this time.
0 commit comments