diff --git a/src/display/canvas.js b/src/display/canvas.js index 5c0b055007017..13f0790a9123b 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -2701,9 +2701,12 @@ class CanvasGraphics { } else { resetCtxToDefault(this.ctx); + // Consume a potential path before clipping. + this.endPath(); + this.ctx.rect(rect[0], rect[1], width, height); this.ctx.clip(); - this.endPath(); + this.ctx.beginPath(); } } diff --git a/test/pdfs/issue18058.pdf.link b/test/pdfs/issue18058.pdf.link new file mode 100644 index 0000000000000..b774ddf0a1724 --- /dev/null +++ b/test/pdfs/issue18058.pdf.link @@ -0,0 +1 @@ +https://github.com/mozilla/pdf.js/files/15269193/file.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index c0151de5e59ae..8a9359249228e 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -10474,5 +10474,13 @@ "pageIndex": 0 } } + }, + { + "id": "issue18058", + "file": "pdfs/issue18058.pdf", + "md5": "da8fcdf25c83ecb2d4be315be5affc3c", + "rounds": 1, + "link": true, + "type": "eq" } ]