diff --git a/src/core/annotation.js b/src/core/annotation.js index 0a8c1f11b..e7e8c2939 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -2648,6 +2648,11 @@ class SquareAnnotation extends MarkupAnnotation { } const fillAlpha = fillColor ? strokeAlpha : null; + if (this.borderStyle.width === 0 && !fillColor) { + // Prevent rendering a "hairline" border (fixes issue14164.pdf). + return; + } + this._setDefaultAppearance({ xref: parameters.xref, extra: `${this.borderStyle.width} w`, @@ -2697,6 +2702,11 @@ class CircleAnnotation extends MarkupAnnotation { } const fillAlpha = fillColor ? strokeAlpha : null; + if (this.borderStyle.width === 0 && !fillColor) { + // Prevent rendering a "hairline" border (fixes issue14164.pdf). + return; + } + // Circles are approximated by Bézier curves with four segments since // there is no circle primitive in the PDF specification. For the control // points distance, see https://stackoverflow.com/a/27863181. diff --git a/test/pdfs/issue14164.pdf.link b/test/pdfs/issue14164.pdf.link new file mode 100644 index 000000000..cdd49e3b9 --- /dev/null +++ b/test/pdfs/issue14164.pdf.link @@ -0,0 +1 @@ +https://github.com/mozilla/pdf.js/files/7372181/Test.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 2c6007b6a..671327e98 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -973,6 +973,14 @@ "enableXfa": true, "type": "eq" }, + { "id": "issue14164", + "file": "pdfs/issue14164.pdf", + "md5": "feb444c716b0337efff8094b156def32", + "rounds": 1, + "link": true, + "lastPage": 1, + "type": "eq" + }, { "id": "xfa_filled_imm1344e", "file": "pdfs/xfa_filled_imm1344e.pdf", "md5": "0576d16692fcd8ef2366cb48bf296e81",