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).
This commit is contained in:
Jonas Jenwald 2021-12-18 11:35:21 +01:00
parent d3e1d7090a
commit 6b75e46d11

View File

@ -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;