diff --git a/web/app.js b/web/app.js index ff7e5d912..784aa1537 100644 --- a/web/app.js +++ b/web/app.js @@ -1790,19 +1790,18 @@ function webViewerUpdateViewarea(evt) { } function webViewerResize() { - let currentScaleValue = PDFViewerApplication.pdfViewer.currentScaleValue; + let { pdfDocument, pdfViewer, } = PDFViewerApplication; + if (!pdfDocument) { + return; + } + let currentScaleValue = pdfViewer.currentScaleValue; if (currentScaleValue === 'auto' || currentScaleValue === 'page-fit' || currentScaleValue === 'page-width') { // Note: the scale is constant for 'page-actual'. - PDFViewerApplication.pdfViewer.currentScaleValue = currentScaleValue; - } else if (!currentScaleValue) { - // Normally this shouldn't happen, but if the scale wasn't initialized - // we set it to the default value in order to prevent any issues. - // (E.g. the document being rendered with the wrong scale on load.) - PDFViewerApplication.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE; + pdfViewer.currentScaleValue = currentScaleValue; } - PDFViewerApplication.pdfViewer.update(); + pdfViewer.update(); } function webViewerHashchange(evt) {