Skip to content

Remove the unused skipCount parameter from Catalog.getPageDict (PR 14311 follow-up) #14325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ class Catalog {
});
}

getPageDict(pageIndex, skipCount = false) {
getPageDict(pageIndex) {
const capability = createPromiseCapability();
const nodesToVisit = [this._catDict.getRaw("Pages")];
const visitedNodes = new RefSet();
Expand Down Expand Up @@ -1153,7 +1153,7 @@ class Catalog {
throw ex;
}
}
if (Number.isInteger(count) && count >= 0 && !skipCount) {
if (Number.isInteger(count) && count >= 0) {
// Cache the Kids count, since it can reduce redundant lookups in
// documents where all nodes are found at *one* level of the tree.
const objId = currentNode.objId;
Expand Down
2 changes: 1 addition & 1 deletion src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ class PDFDocument {
let pageIndex = 1; // The first page was already loaded.
while (true) {
try {
await this.getPage(pageIndex, /* skipCount = */ true);
await this.getPage(pageIndex);
} catch (reasonLoop) {
if (reasonLoop instanceof PageDictMissingException) {
break;
Expand Down
8 changes: 8 additions & 0 deletions test/unit/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,14 @@ describe("api", function () {
const pdfDocument = await loadingTask.promise;
expect(pdfDocument.numPages).toEqual(1);

const page = await pdfDocument.getPage(1);
expect(page instanceof PDFPageProxy).toEqual(true);

const opList = await page.getOperatorList();
expect(opList.fnArray.length).toEqual(0);
expect(opList.argsArray.length).toEqual(0);
expect(opList.lastChunk).toEqual(true);

await loadingTask.destroy();
});

Expand Down