diff --git a/src/core/document.js b/src/core/document.js index 993f8fa39..aba5117ef 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -137,8 +137,8 @@ class Page { if (cropBox === mediaBox || isArrayEqual(cropBox, mediaBox)) { view = mediaBox; } else { - const box = Util.intersect(cropBox, mediaBox, /* skipEmpty = */ true); - if (box) { + const box = Util.intersect(cropBox, mediaBox); + if (box && ((box[2] - box[0]) !== 0 && (box[3] - box[1]) !== 0)) { view = box; } else { warn('Empty /CropBox and /MediaBox intersection.'); diff --git a/src/shared/util.js b/src/shared/util.js index bc29e9d2b..e2545ffc0 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -748,7 +748,7 @@ var Util = (function UtilClosure() { // Returns a rectangle [x1, y1, x2, y2] corresponding to the // intersection of rect1 and rect2. If no intersection, returns 'false' // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2] - Util.intersect = function Util_intersect(rect1, rect2, skipEmpty = false) { + Util.intersect = function Util_intersect(rect1, rect2) { function compare(a, b) { return a - b; } @@ -781,10 +781,6 @@ var Util = (function UtilClosure() { return null; } - if (skipEmpty && - ((result[2] - result[0]) === 0 || (result[3] - result[1]) === 0)) { - return null; - } return result; };