File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ const DEFAULT_CACHE_SIZE = 10;
57
57
const PagesCountLimit = {
58
58
FORCE_SCROLL_MODE_PAGE : 15000 ,
59
59
FORCE_LAZY_PAGE_INIT : 7500 ,
60
+ PAUSE_EAGER_PAGE_INIT : 500 ,
60
61
} ;
61
62
62
63
/**
@@ -625,7 +626,7 @@ class BaseViewer {
625
626
// Fetch all the pages since the viewport is needed before printing
626
627
// starts to create the correct size canvas. Wait until one page is
627
628
// rendered so we don't tie up too many resources early on.
628
- this . _onePageRenderedOrForceFetch ( ) . then ( ( ) => {
629
+ this . _onePageRenderedOrForceFetch ( ) . then ( async ( ) => {
629
630
if ( this . findController ) {
630
631
this . findController . setDocument ( pdfDocument ) ; // Enable searching.
631
632
}
@@ -650,7 +651,7 @@ class BaseViewer {
650
651
return ;
651
652
}
652
653
for ( let pageNum = 2 ; pageNum <= pagesCount ; ++ pageNum ) {
653
- pdfDocument . getPage ( pageNum ) . then (
654
+ const promise = pdfDocument . getPage ( pageNum ) . then (
654
655
pdfPage => {
655
656
const pageView = this . _pages [ pageNum - 1 ] ;
656
657
if ( ! pageView . pdfPage ) {
@@ -671,6 +672,10 @@ class BaseViewer {
671
672
}
672
673
}
673
674
) ;
675
+
676
+ if ( pageNum % PagesCountLimit . PAUSE_EAGER_PAGE_INIT === 0 ) {
677
+ await promise ;
678
+ }
674
679
}
675
680
} ) ;
676
681
You can’t perform that action at this time.
0 commit comments