Merge pull request #13457 from Snuffleupagus/issue-13242

Work-around for HighlightAnnotations without a top-level /ExtGState-entry (issue 13242)
This commit is contained in:
Tim van der Meij 2021-05-28 23:38:39 +02:00 committed by GitHub
commit 5e5641b147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View File

@ -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)

View File

@ -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

BIN
test/pdfs/issue13242.pdf Normal file

Binary file not shown.

View File

@ -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",