File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3723,9 +3723,25 @@ page 1 / 3`);
37233723 vertical : false ,
37243724 } ) ;
37253725
3726- // Wait for font data to be loaded so we can check that the font names
3727- // match.
3728- await pdfPage . getOperatorList ( ) ;
3726+ // Render the page to make sure that the font data is loaded so we can
3727+ // check that the font name in `commonObjs` matches.
3728+ const { canvasFactory } = pdfDoc ;
3729+ const viewport = pdfPage . getViewport ( { scale : 1 } ) ;
3730+
3731+ const canvasAndCtx = canvasFactory . create (
3732+ viewport . width ,
3733+ viewport . height
3734+ ) ;
3735+ const renderTask = pdfPage . render ( {
3736+ canvas : canvasAndCtx . canvas ,
3737+ viewport,
3738+ } ) ;
3739+
3740+ await renderTask . promise ;
3741+ // The canvas is no longer necessary, since we only care about the
3742+ // `commonObjs` property being populated below.
3743+ canvasFactory . destroy ( canvasAndCtx ) ;
3744+
37293745 expect ( pdfPage . commonObjs . has ( fontName ) ) . toEqual ( true ) ;
37303746
37313747 await loadingTask . destroy ( ) ;
You can’t perform that action at this time.
0 commit comments