@@ -465,7 +465,7 @@ class PartialEvaluator {
465465 localColorSpaceCache ,
466466 seenRefs
467467 ) {
468- const dict = xobj . dict ;
468+ const { dict } = xobj ;
469469 const matrix = lookupMatrix ( dict . getArray ( "Matrix" ) , null ) ;
470470 const bbox = lookupNormalRect ( dict . getArray ( "BBox" ) , null ) ;
471471
@@ -521,10 +521,12 @@ class PartialEvaluator {
521521 const args = [ f32matrix , f32bbox ] ;
522522 operatorList . addOp ( OPS . paintFormXObjectBegin , args ) ;
523523
524+ const localResources = dict . get ( "Resources" ) ;
525+
524526 await this . getOperatorList ( {
525527 stream : xobj ,
526528 task,
527- resources : dict . get ( "Resources" ) || resources ,
529+ resources : localResources instanceof Dict ? localResources : resources ,
528530 operatorList,
529531 initialState,
530532 prevRefs : seenRefs ,
@@ -3298,14 +3300,15 @@ class PartialEvaluator {
32983300 if ( ! ( xobj instanceof BaseStream ) ) {
32993301 throw new FormatError ( "XObject should be a stream" ) ;
33003302 }
3303+ const { dict } = xobj ;
33013304
3302- const type = xobj . dict . get ( "Subtype" ) ;
3305+ const type = dict . get ( "Subtype" ) ;
33033306 if ( ! ( type instanceof Name ) ) {
33043307 throw new FormatError ( "XObject should have a Name subtype" ) ;
33053308 }
33063309
33073310 if ( type . name !== "Form" ) {
3308- emptyXObjectCache . set ( name , xobj . dict . objId , true ) ;
3311+ emptyXObjectCache . set ( name , dict . objId , true ) ;
33093312
33103313 resolveXObject ( ) ;
33113314 return ;
@@ -3319,11 +3322,13 @@ class PartialEvaluator {
33193322 const currentState = stateManager . state . clone ( ) ;
33203323 const xObjStateManager = new StateManager ( currentState ) ;
33213324
3322- const matrix = lookupMatrix ( xobj . dict . getArray ( "Matrix" ) , null ) ;
3325+ const matrix = lookupMatrix ( dict . getArray ( "Matrix" ) , null ) ;
33233326 if ( matrix ) {
33243327 xObjStateManager . transform ( matrix ) ;
33253328 }
33263329
3330+ const localResources = dict . get ( "Resources" ) ;
3331+
33273332 // Enqueue the `textContent` chunk before parsing the /Form
33283333 // XObject.
33293334 enqueueChunk ( ) ;
@@ -3348,7 +3353,10 @@ class PartialEvaluator {
33483353 . getTextContent ( {
33493354 stream : xobj ,
33503355 task,
3351- resources : xobj . dict . get ( "Resources" ) || resources ,
3356+ resources :
3357+ localResources instanceof Dict
3358+ ? localResources
3359+ : resources ,
33523360 stateManager : xObjStateManager ,
33533361 includeMarkedContent,
33543362 sink : sinkWrapper ,
@@ -3362,7 +3370,7 @@ class PartialEvaluator {
33623370 } )
33633371 . then ( function ( ) {
33643372 if ( ! sinkWrapper . enqueueInvoked ) {
3365- emptyXObjectCache . set ( name , xobj . dict . objId , true ) ;
3373+ emptyXObjectCache . set ( name , dict . objId , true ) ;
33663374 }
33673375 resolveXObject ( ) ;
33683376 } , rejectXObject ) ;
0 commit comments