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:
Jonas Jenwald 2023-10-03 08:01:55 +02:00
parent da4fdc76a3
commit bf9c33e60f
7 changed files with 62 additions and 19 deletions

View file

@ -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();
});