diff --git a/src/core/document.js b/src/core/document.js index c59d3752b..691ba8802 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -1576,7 +1576,10 @@ class PDFDocument { if (type instanceof Ref) { type = await xref.fetchAsync(type); } - if (isName(type, "Page") || (!obj.has("Type") && !obj.has("Kids"))) { + if ( + isName(type, "Page") || + (!obj.has("Type") && !obj.has("Kids") && obj.has("Contents")) + ) { if (!catalog.pageKidsCountCache.has(ref)) { catalog.pageKidsCountCache.put(ref, 1); // Cache the Page reference. } diff --git a/test/pdfs/issue18138.pdf.link b/test/pdfs/issue18138.pdf.link new file mode 100644 index 000000000..62543168e --- /dev/null +++ b/test/pdfs/issue18138.pdf.link @@ -0,0 +1 @@ +https://github.com/mozilla/pdf.js/files/15398373/2.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 5f1487205..eb6aceb61 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -5438,6 +5438,15 @@ "lastPage": 1, "type": "eq" }, + { + "id": "issue18138", + "file": "pdfs/issue18138.pdf", + "md5": "06136495b2dee5faed2e87c4e49d17fd", + "rounds": 1, + "link": true, + "lastPage": 1, + "type": "eq" + }, { "id": "issue4890", "file": "pdfs/issue4890.pdf",