From 1c5a754ff0acb33258bcaf094ca90c799cb342e9 Mon Sep 17 00:00:00 2001 From: "Richard Smith (smir)" Date: Tue, 20 Aug 2024 16:41:02 +0100 Subject: [PATCH] Random access page loading - fixed which page to load --- src/core/catalog.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/core/catalog.js b/src/core/catalog.js index a91676d03..1d6116ebe 100644 --- a/src/core/catalog.js +++ b/src/core/catalog.js @@ -1212,9 +1212,7 @@ class Catalog { } visitedNodes.put(currentNode); - const obj = - (await this.pageDictCache.get(currentNode)) || - xref.fetchAsync(currentNode); + const obj = await xref.fetchAsync(currentNode); if (obj instanceof Dict) { const isPage = await getIsPage(obj); @@ -1302,13 +1300,13 @@ class Catalog { count >= MIN_PAGES_TO_ASSUME_ALL_TOP_LEVEL && count === kids.length ) { - const maybePage = await xref.fetchAsync(kids[currentPageIndex]); + const maybePage = await xref.fetchAsync(kids[pageIndex]); const isPage = await getIsPage(maybePage); if (isPage) { - return [maybePage, kids[currentPageIndex]]; + return [maybePage, kids[pageIndex]]; } } - + for (let last = kids.length - 1; last >= 0; last--) { nodesToVisit.push(kids[last]); }