1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #13415 from Snuffleupagus/getDestination-out-of-order

Improve handling of named destinations in out-of-order NameTrees (PR 10274 follow-up)
This commit is contained in:
Tim van der Meij 2021-05-21 20:15:09 +02:00 committed by GitHub
commit d1d9b9043d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 27 deletions

View file

@ -0,0 +1 @@
https://github.com/mozilla/pdf.js/files/2598691/ATS_TEST_PVC_2_1.pdf

View file

@ -917,6 +917,12 @@
"link": true,
"type": "load"
},
{ "id": "issue10272",
"file": "pdfs/issue10272.pdf",
"md5": "bf3b2f74c6878d38a70dc0825f1b9a02",
"link": true,
"type": "other"
},
{ "id": "issue10388",
"file": "pdfs/issue10388_reduced.pdf",
"md5": "62a6b2adbea1535432bd94a3516e2d4c",

View file

@ -669,6 +669,24 @@ describe("api", function () {
await loadingTask.destroy();
});
it("gets a destination, from out-of-order /Names (NameTree) dictionary (issue 10272)", async function () {
if (isNodeJS) {
pending("Linked test-cases are not supported in Node.js.");
}
const loadingTask = getDocument(buildGetDocumentParams("issue10272.pdf"));
const pdfDoc = await loadingTask.promise;
const destination = await pdfDoc.getDestination("link_1");
expect(destination).toEqual([
{ num: 17, gen: 0 },
{ name: "XYZ" },
69,
125,
0,
]);
await loadingTask.destroy();
});
it("gets non-string destination", async function () {
let numberPromise = pdfDocument.getDestination(4.3);
let booleanPromise = pdfDocument.getDestination(true);