Skip to content
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

Work-around for HighlightAnnotations without a top-level /ExtGState-entry (issue 13242) #13457

Merged
merged 1 commit into from
May 28, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/core/annotation.js
Expand Up @@ -2676,7 +2676,17 @@ class HighlightAnnotation extends MarkupAnnotation {
null
));
if (quadPoints) {
if (!this.appearance) {
const resources =
this.appearance && this.appearance.dict.get("Resources");

if (!this.appearance || !(resources && resources.has("ExtGState"))) {
if (this.appearance) {
// Workaround for cases where there's no /ExtGState-entry directly
// available, e.g. when the appearance stream contains a /XObject of
// the /Form-type, since that causes the highlighting to completely
// obsure the PDF content below it (fixes issue13242.pdf).
warn("HighlightAnnotation - ignoring built-in appearance stream.");
}
// Default color is yellow in Acrobat Reader
const fillColor = this.color
? Array.from(this.color).map(c => c / 255)
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Expand Up @@ -254,6 +254,7 @@
!find_all.pdf
!helloworld-bad.pdf
!zerowidthline.pdf
!issue13242.pdf
!js-colors.pdf
!annotation-line-without-appearance-empty-Rect.pdf
!issue12841_reduced.pdf
Expand Down
Binary file added test/pdfs/issue13242.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions test/test_manifest.json
Expand Up @@ -2324,6 +2324,13 @@
"lastPage": 1,
"type": "eq"
},
{ "id": "issue13242",
"file": "pdfs/issue13242.pdf",
"md5": "ceb2da908c972087eb90e6bae240bce9",
"rounds": 1,
"type": "eq",
"annotations": true
},
{ "id": "issue7229",
"file": "pdfs/issue7229.pdf",
"md5": "480e51aae0ac271780e4603d1561d15e",
Expand Down