mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Add support for "GoToE" actions with destinations (issue 17056)
This shouldn't be very common in practice, since "GoToE" actions themselves seem quite uncommon; see PR 15537.
This commit is contained in:
parent
da4fdc76a3
commit
bf9c33e60f
7 changed files with 62 additions and 19 deletions
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -51,6 +51,7 @@
|
|||
!issue7439.pdf
|
||||
!issue7847_radial.pdf
|
||||
!issue8844.pdf
|
||||
!issue17056.pdf
|
||||
!issue14953.pdf
|
||||
!issue15367.pdf
|
||||
!issue15372.pdf
|
||||
|
|
BIN
test/pdfs/issue17056.pdf
Normal file
BIN
test/pdfs/issue17056.pdf
Normal file
Binary file not shown.
|
@ -2855,6 +2855,29 @@ describe("api", function () {
|
|||
expect(content instanceof Uint8Array).toEqual(true);
|
||||
expect(content.length).toEqual(4508);
|
||||
|
||||
expect(annotations[0].attachmentDest).toEqual('[-1,{"name":"Fit"}]');
|
||||
|
||||
await loadingTask.destroy();
|
||||
});
|
||||
|
||||
it("gets annotations containing GoToE action with destination (issue 17056)", async function () {
|
||||
const loadingTask = getDocument(buildGetDocumentParams("issue17056.pdf"));
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
const pdfPage = await pdfDoc.getPage(1);
|
||||
|
||||
const annotations = await pdfPage.getAnnotations();
|
||||
expect(annotations.length).toEqual(30);
|
||||
|
||||
const { annotationType, attachment, attachmentDest } = annotations[0];
|
||||
expect(annotationType).toEqual(AnnotationType.LINK);
|
||||
|
||||
const { filename, content } = attachment;
|
||||
expect(filename).toEqual("destination-doc.pdf");
|
||||
expect(content instanceof Uint8Array).toEqual(true);
|
||||
expect(content.length).toEqual(10305);
|
||||
|
||||
expect(attachmentDest).toEqual('[0,{"name":"Fit"}]');
|
||||
|
||||
await loadingTask.destroy();
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue