From 6b75e46d110cde77e3c5375de09170cc6760ca18 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 18 Dec 2021 11:35:21 +0100 Subject: [PATCH] Ignore *negative* /FitH parameters in the viewer (issue 14385) This provides a work-around for badly generated PDF documents that contain *negative* /FitH parameters (in the referenced issue the value `-32768` is used). --- web/base_viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/base_viewer.js b/web/base_viewer.js index affa751c4..f1932dc63 100644 --- a/web/base_viewer.js +++ b/web/base_viewer.js @@ -1173,7 +1173,7 @@ class BaseViewer { if (y === null && this._location) { x = this._location.left; y = this._location.top; - } else if (typeof y !== "number") { + } else if (typeof y !== "number" || y < 0) { // The "top" value isn't optional, according to the spec, however some // bad PDF generators will pretend that it is (fixes bug 1663390). y = pageHeight;