Merge pull request #14166 from Snuffleupagus/issue-14164

Ignore Square/Circle-annnotations with a zero borderWidth when creating a fallback appearance stream (issue 14164)
This commit is contained in:
Jonas Jenwald 2021-10-19 16:32:59 +02:00 committed by GitHub
commit 81eafcbd5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View File

@ -2648,6 +2648,11 @@ class SquareAnnotation extends MarkupAnnotation {
} }
const fillAlpha = fillColor ? strokeAlpha : null; const fillAlpha = fillColor ? strokeAlpha : null;
if (this.borderStyle.width === 0 && !fillColor) {
// Prevent rendering a "hairline" border (fixes issue14164.pdf).
return;
}
this._setDefaultAppearance({ this._setDefaultAppearance({
xref: parameters.xref, xref: parameters.xref,
extra: `${this.borderStyle.width} w`, extra: `${this.borderStyle.width} w`,
@ -2697,6 +2702,11 @@ class CircleAnnotation extends MarkupAnnotation {
} }
const fillAlpha = fillColor ? strokeAlpha : null; 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 // Circles are approximated by Bézier curves with four segments since
// there is no circle primitive in the PDF specification. For the control // there is no circle primitive in the PDF specification. For the control
// points distance, see https://stackoverflow.com/a/27863181. // points distance, see https://stackoverflow.com/a/27863181.

View File

@ -0,0 +1 @@
https://github.com/mozilla/pdf.js/files/7372181/Test.pdf

View File

@ -973,6 +973,14 @@
"enableXfa": true, "enableXfa": true,
"type": "eq" "type": "eq"
}, },
{ "id": "issue14164",
"file": "pdfs/issue14164.pdf",
"md5": "feb444c716b0337efff8094b156def32",
"rounds": 1,
"link": true,
"lastPage": 1,
"type": "eq"
},
{ "id": "xfa_filled_imm1344e", { "id": "xfa_filled_imm1344e",
"file": "pdfs/xfa_filled_imm1344e.pdf", "file": "pdfs/xfa_filled_imm1344e.pdf",
"md5": "0576d16692fcd8ef2366cb48bf296e81", "md5": "0576d16692fcd8ef2366cb48bf296e81",