diff --git a/web/base_viewer.js b/web/base_viewer.js index 3b9b78ca40e1a..240d6b75a2854 100644 --- a/web/base_viewer.js +++ b/web/base_viewer.js @@ -725,6 +725,20 @@ class BaseViewer { } } + /** + * @private + */ + get _pageWidthScaleFactor() { + if ( + this.spreadMode !== SpreadMode.NONE && + this.scrollMode !== ScrollMode.HORIZONTAL && + !this.isInPresentationMode + ) { + return 2; + } + return 1; + } + _setScale(value, noScroll = false) { let scale = parseFloat(value); @@ -743,8 +757,9 @@ class BaseViewer { [hPadding, vPadding] = [vPadding, hPadding]; // Swap the padding values. } const pageWidthScale = - ((this.container.clientWidth - hPadding) / currentPage.width) * - currentPage.scale; + (((this.container.clientWidth - hPadding) / currentPage.width) * + currentPage.scale) / + this._pageWidthScaleFactor; const pageHeightScale = ((this.container.clientHeight - vPadding) / currentPage.height) * currentPage.scale; @@ -1473,6 +1488,9 @@ class BaseViewer { if (!pageNumber) { return; } + if (this._currentScaleValue && isNaN(this._currentScaleValue)) { + this._setScale(this._currentScaleValue, true); + } this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true); this.update(); } diff --git a/web/pdf_single_page_viewer.js b/web/pdf_single_page_viewer.js index 1e835897d0896..20b340e1336d0 100644 --- a/web/pdf_single_page_viewer.js +++ b/web/pdf_single_page_viewer.js @@ -35,6 +35,10 @@ class PDFSinglePageViewer extends BaseViewer { return shadow(this, "_viewerElement", this._shadowViewer); } + get _pageWidthScaleFactor() { + return 1; + } + _resetView() { super._resetView(); this._previousPageNumber = 1;