@@ -552,21 +552,46 @@ class Page {
552552 } ) ;
553553 }
554554
555+ // Wait for annotations to check their resources for canvas filters
556+ // before sending StartRenderPage (fixes issue17069).
557+ const annotationsPromise = this . _parsedAnnotations ;
558+
555559 const pageListPromise = Promise . all ( [
556560 contentStreamPromise ,
557561 resourcesPromise ,
558- ] ) . then ( async ( [ contentStream ] ) => {
562+ annotationsPromise ,
563+ ] ) . then ( async ( [ contentStream , , parsedAnnotations ] ) => {
559564 const resources = await this . #getMergedResources(
560565 contentStream . dict ,
561566 RESOURCES_KEYS_OPERATOR_LIST
562567 ) ;
568+
569+ // Check for canvas filters in page resources and annotation resources.
570+ let hasCanvasFilters = partialEvaluator . hasCanvasFilters ( resources ) ;
571+ if ( ! hasCanvasFilters ) {
572+ // Check annotation appearance resources for canvas filters.
573+ for ( const annotation of parsedAnnotations ) {
574+ const appearance = annotation . appearance ;
575+ if ( appearance ) {
576+ const annotResources = appearance . dict ?. get ( "Resources" ) ;
577+ if (
578+ annotResources &&
579+ partialEvaluator . hasCanvasFilters ( annotResources )
580+ ) {
581+ hasCanvasFilters = true ;
582+ break ;
583+ }
584+ }
585+ }
586+ }
587+
563588 const opList = new OperatorList ( intent , sink ) ;
564589 handler . send ( "StartRenderPage" , {
565590 transparency : partialEvaluator . hasBlendModes (
566591 resources ,
567592 this . nonBlendModesSet
568593 ) ,
569- hasCanvasFilters : partialEvaluator . hasCanvasFilters ( resources ) ,
594+ hasCanvasFilters,
570595 pageIndex,
571596 cacheKey,
572597 } ) ;
@@ -585,7 +610,7 @@ class Page {
585610 // eslint-disable-next-line prefer-const
586611 let [ pageOpList , annotations , newAnnotations ] = await Promise . all ( [
587612 pageListPromise ,
588- this . _parsedAnnotations ,
613+ annotationsPromise ,
589614 newAnnotationsPromise ,
590615 ] ) ;
591616
0 commit comments