diff --git a/src/core/annotation.js b/src/core/annotation.js index 9ade49e82..92dbef74f 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -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) diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 1abd53fd2..ea1044a8d 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -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 diff --git a/test/pdfs/issue13242.pdf b/test/pdfs/issue13242.pdf new file mode 100644 index 000000000..3fc33eccc Binary files /dev/null and b/test/pdfs/issue13242.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 2bc7d078d..494dc9664 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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",