diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 22d5a1604..70ade2c5b 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -1122,6 +1122,12 @@ class PartialEvaluator { case "Type": break; case "LW": + if (typeof value !== "number") { + warn(`Invalid LW (line width): ${value}`); + break; + } + gStateObj.push([key, Math.abs(value)]); + break; case "LC": case "LJ": case "ML": @@ -2212,6 +2218,18 @@ class PartialEvaluator { }) ); return; + case OPS.setLineWidth: { + // The thickness should be a non-negative number, as per spec. + // When the value is negative, Acrobat and Poppler take the absolute + // value while PDFium takes the max of 0 and the value. + const [thickness] = args; + if (typeof thickness !== "number") { + warn(`Invalid setLineWidth: ${thickness}`); + continue; + } + args[0] = Math.abs(thickness); + break; + } case OPS.moveTo: case OPS.lineTo: case OPS.curveTo: diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 900b36d08..2b06b3a4e 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -711,3 +711,4 @@ !issue19505.pdf !colors.pdf !red_stamp.pdf +!issue19633.pdf diff --git a/test/pdfs/issue19633.pdf b/test/pdfs/issue19633.pdf new file mode 100755 index 000000000..34ca03ffa Binary files /dev/null and b/test/pdfs/issue19633.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index bfa914535..e660566a9 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -11971,5 +11971,12 @@ "rounds": 1, "link": true, "type": "eq" + }, + { + "id": "issue19633", + "file": "pdfs/issue19633.pdf", + "md5": "9993aa298c0214a3d3ff5f90ce0d40bb", + "rounds": 1, + "type": "eq" } ]