Skip to content

Commit

Permalink
Merge pull request #10949 from Snuffleupagus/delay-findController-init
Browse files Browse the repository at this point in the history
Delay initialization of searching, in the viewer, until the first page has rendered
  • Loading branch information
timvandermeij committed Jul 8, 2019
2 parents d66d273 + d3c0f28 commit d7afb74
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web/base_viewer.js
Expand Up @@ -443,6 +443,10 @@ class BaseViewer {
// starts to create the correct size canvas. Wait until one page is
// rendered so we don't tie up too many resources early on.
onePageRenderedCapability.promise.then(() => {
if (this.findController) {
this.findController.setDocument(pdfDocument); // Enable searching.
}

if (pdfDocument.loadingParams['disableAutoFetch']) {
// XXX: Printing is semi-broken with auto fetch disabled.
pagesCapability.resolve();
Expand Down Expand Up @@ -471,9 +475,6 @@ class BaseViewer {

this.eventBus.dispatch('pagesinit', { source: this, });

if (this.findController) {
this.findController.setDocument(pdfDocument); // Enable searching.
}
if (this.defaultRenderingQueue) {
this.update();
}
Expand Down

0 comments on commit d7afb74

Please sign in to comment.