Random access page loading - fixed which page to load

This commit is contained in:
Richard Smith (smir) 2024-08-20 16:41:02 +01:00
parent 83e68b3b27
commit 1c5a754ff0

View File

@ -1212,9 +1212,7 @@ class Catalog {
} }
visitedNodes.put(currentNode); visitedNodes.put(currentNode);
const obj = const obj = await xref.fetchAsync(currentNode);
(await this.pageDictCache.get(currentNode)) ||
xref.fetchAsync(currentNode);
if (obj instanceof Dict) { if (obj instanceof Dict) {
const isPage = await getIsPage(obj); const isPage = await getIsPage(obj);
@ -1302,10 +1300,10 @@ class Catalog {
count >= MIN_PAGES_TO_ASSUME_ALL_TOP_LEVEL && count >= MIN_PAGES_TO_ASSUME_ALL_TOP_LEVEL &&
count === kids.length count === kids.length
) { ) {
const maybePage = await xref.fetchAsync(kids[currentPageIndex]); const maybePage = await xref.fetchAsync(kids[pageIndex]);
const isPage = await getIsPage(maybePage); const isPage = await getIsPage(maybePage);
if (isPage) { if (isPage) {
return [maybePage, kids[currentPageIndex]]; return [maybePage, kids[pageIndex]];
} }
} }