Skip to content

Ignore Square/Circle-annnotations with a zero borderWidth when creating a fallback appearance stream (issue 14164) #14166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/core/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/issue14164.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/mozilla/pdf.js/files/7372181/Test.pdf
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down