1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Always use the absolute value of the line thickness (issue 19633)

This commit is contained in:
Calixte Denizet 2025-03-10 23:47:34 +01:00
parent d008452e80
commit 4b4f85484e
4 changed files with 26 additions and 0 deletions

View file

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

View file

@ -711,3 +711,4 @@
!issue19505.pdf
!colors.pdf
!red_stamp.pdf
!issue19633.pdf

BIN
test/pdfs/issue19633.pdf Executable file

Binary file not shown.

View file

@ -11971,5 +11971,12 @@
"rounds": 1,
"link": true,
"type": "eq"
},
{
"id": "issue19633",
"file": "pdfs/issue19633.pdf",
"md5": "9993aa298c0214a3d3ff5f90ce0d40bb",
"rounds": 1,
"type": "eq"
}
]