From f4ba0e342e0de0bf94eb5b38d520c1d751d2d64b Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Fri, 5 Jun 2015 23:55:08 +0200 Subject: [PATCH] Check availability of canvas & PDF before printing --- web/mozPrintCallback_polyfill.js | 2 +- web/viewer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/mozPrintCallback_polyfill.js b/web/mozPrintCallback_polyfill.js index a9416c143..8127a8e8a 100644 --- a/web/mozPrintCallback_polyfill.js +++ b/web/mozPrintCallback_polyfill.js @@ -82,7 +82,7 @@ function renderProgress() { var progressContainer = document.getElementById('mozPrintCallback-shim'); - if (canvases) { + if (canvases && canvases.length) { var progress = Math.round(100 * index / canvases.length); var progressBar = progressContainer.querySelector('progress'); var progressPerc = progressContainer.querySelector('.relative-progress'); diff --git a/web/viewer.js b/web/viewer.js index 0b473c0eb..36178a782 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -1101,7 +1101,7 @@ var PDFViewerApplication = { var alertNotReady = false; var i, ii; - if (!this.pagesCount) { + if (!this.pdfDocument || !this.pagesCount) { alertNotReady = true; } else { for (i = 0, ii = this.pagesCount; i < ii; ++i) {