From 670b842e090fec5a7ad4c937ce7276c914b4fe13 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 12 Oct 2014 02:25:35 +0200 Subject: [PATCH] Fix "Automatic Zoom" for landscape documents with very wide pages (issue 5398) --- web/pdf_viewer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index a64f39b55..47e109fab 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -374,8 +374,10 @@ var PDFViewer = (function pdfViewer() { break; case 'auto': var isLandscape = (currentPage.width > currentPage.height); - var horizontalScale = isLandscape ? pageHeightScale : - pageWidthScale; + // For pages in landscape mode, fit the page height to the viewer + // *unless* the page would thus become too wide to fit horizontally. + var horizontalScale = isLandscape ? + Math.min(pageHeightScale, pageWidthScale) : pageWidthScale; scale = Math.min(MAX_AUTO_SCALE, horizontalScale); break; default: