mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[api-minor] Support Named-actions in the outline (issue 15367)
Apparently this is implemented in e.g. Adobe Reader, and the specification does support it, however it cannot be commonly used in real-world PDF documents since it took over ten years for this feature to be requested.
This commit is contained in:
parent
86370bd5c5
commit
216b86a082
5 changed files with 38 additions and 2 deletions
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -50,6 +50,7 @@
|
|||
!issue7439.pdf
|
||||
!issue7847_radial.pdf
|
||||
!issue14953.pdf
|
||||
!issue15367.pdf
|
||||
!issue7446.pdf
|
||||
!issue7492.pdf
|
||||
!issue7544.pdf
|
||||
|
|
BIN
test/pdfs/issue15367.pdf
Normal file
BIN
test/pdfs/issue15367.pdf
Normal file
Binary file not shown.
|
@ -1535,6 +1535,7 @@ describe("api", function () {
|
|||
expect(outline.length).toEqual(6);
|
||||
|
||||
expect(outline[4]).toEqual({
|
||||
action: null,
|
||||
dest: "Händel -- Halle🎆lujah",
|
||||
url: null,
|
||||
unsafeUrl: undefined,
|
||||
|
@ -1550,6 +1551,31 @@ describe("api", function () {
|
|||
await loadingTask.destroy();
|
||||
});
|
||||
|
||||
it("gets outline, with named-actions (issue 15367)", async function () {
|
||||
const loadingTask = getDocument(buildGetDocumentParams("issue15367.pdf"));
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
const outline = await pdfDoc.getOutline();
|
||||
|
||||
expect(Array.isArray(outline)).toEqual(true);
|
||||
expect(outline.length).toEqual(4);
|
||||
|
||||
expect(outline[1]).toEqual({
|
||||
action: "PrevPage",
|
||||
dest: null,
|
||||
url: null,
|
||||
unsafeUrl: undefined,
|
||||
newWindow: undefined,
|
||||
title: "Previous Page",
|
||||
color: new Uint8ClampedArray([0, 0, 0]),
|
||||
count: undefined,
|
||||
bold: false,
|
||||
italic: false,
|
||||
items: [],
|
||||
});
|
||||
|
||||
await loadingTask.destroy();
|
||||
});
|
||||
|
||||
it("gets outline with non-displayable chars", async function () {
|
||||
const loadingTask = getDocument(buildGetDocumentParams("issue14267.pdf"));
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue