Skip to content

Commit

Permalink
Ensure that attempting to print with disableAutoFetch set will fail…
Browse files Browse the repository at this point in the history
… gracefully (issue 11339)

This patch simply restores the behaviour that existed prior to PR 7697, since I cannot imagine that that was changed other than by pure accident.
As mentioned by a comment in `BaseViewer.setDocument`: "Printing is semi-broken with auto fetch disabled.", and note that since triggering of printing is a *synchronous* operation there's no generally easy way load the missing data.
  • Loading branch information
Snuffleupagus committed Nov 19, 2019
1 parent be02e67 commit 917f018
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/base_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,14 @@ class BaseViewer {
* @type {boolean} - True if all {PDFPageView} objects are initialized.
*/
get pageViewsReady() {
return this._pageViewsReady;
if (!this._pageViewsReady) {
return false;
}
// Prevent printing errors when 'disableAutoFetch' is set, by ensuring
// that *all* pages have in fact been completely loaded.
return this._pages.every(function(pageView) {
return !!(pageView && pageView.pdfPage);
});
}

/**
Expand Down

0 comments on commit 917f018

Please sign in to comment.