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

Display outlines even if one has no title

Fixes #17856.
This commit is contained in:
Calixte Denizet 2024-03-29 20:58:24 +01:00
parent 55db43966e
commit 136c1faa7f
4 changed files with 42 additions and 2 deletions

View file

@ -0,0 +1,2 @@
https://github.com/mozilla/pdf.js/files/14808044/outline-without-title.pdf

View file

@ -9779,5 +9779,13 @@
"rounds": 1,
"link": true,
"type": "eq"
},
{
"id": "issue17856",
"file": "pdfs/issue17856.pdf",
"md5": "b31e5258948f0f4bb99eb5d4127c2162",
"rounds": 1,
"link": true,
"type": "other"
}
]

View file

@ -1719,6 +1719,36 @@ describe("api", function () {
await loadingTask.destroy();
});
it("gets outline, with missing title (issue 17856)", async function () {
if (isNodeJS) {
pending("Linked test-cases are not supported in Node.js.");
}
const loadingTask = getDocument(buildGetDocumentParams("issue17856.pdf"));
const pdfDoc = await loadingTask.promise;
const outline = await pdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true);
expect(outline.length).toEqual(9);
expect(outline[0]).toEqual({
action: null,
attachment: undefined,
dest: "section.1",
url: null,
unsafeUrl: undefined,
newWindow: undefined,
setOCGState: undefined,
title: "",
color: new Uint8ClampedArray([0, 0, 0]),
count: undefined,
bold: false,
italic: false,
items: [],
});
await loadingTask.destroy();
});
it("gets outline, with dest-strings using PDFDocEncoding (issue 14864)", async function () {
if (isNodeJS) {
pending("Linked test-cases are not supported in Node.js.");