diff --git a/src/core/annotation.js b/src/core/annotation.js index d4f59bcbf..f902e8b4c 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -4337,6 +4337,24 @@ class PolylineAnnotation extends MarkupAnnotation { const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; const strokeAlpha = dict.get("CA"); + let fillColor = getRgbColor(dict.getArray("IC"), null); + if (fillColor) { + fillColor = getPdfColorArray(fillColor); + } + + let operator; + if (fillColor) { + if (this.color) { + operator = fillColor.every((c, i) => c === strokeColor[i]) + ? "f" + : "B"; + } else { + operator = "f"; + } + } else { + operator = "S"; + } + const borderWidth = this.borderStyle.width || 1, borderAdjust = 2 * borderWidth; @@ -4361,13 +4379,15 @@ class PolylineAnnotation extends MarkupAnnotation { extra: `${borderWidth} w`, strokeColor, strokeAlpha, + fillColor, + fillAlpha: fillColor ? strokeAlpha : null, pointsCallback: (buffer, points) => { for (let i = 0, ii = vertices.length; i < ii; i += 2) { buffer.push( `${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}` ); } - buffer.push("S"); + buffer.push(operator); return [points[0], points[7], points[2], points[3]]; }, }); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 35f08e9d7..fd0a3e6bb 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -731,3 +731,4 @@ !bug1885505.pdf !bug1974436.pdf !firefox_logo.pdf +!issue20062.pdf diff --git a/test/pdfs/issue20062.pdf b/test/pdfs/issue20062.pdf new file mode 100755 index 000000000..b925c251e Binary files /dev/null and b/test/pdfs/issue20062.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 1038aca95..e3e74f753 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -12164,5 +12164,12 @@ "rounds": 1, "type": "eq", "annotations": true + }, + { + "id": "issue20062", + "file": "pdfs/issue20062.pdf", + "md5": "9fa985242476c642464d94893528e40f", + "rounds": 1, + "type": "eq" } ]