1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

[api-minor] Add partial support for the "GoToE" action (issue 8844)

*Please note:* The referenced issue is the only mention that I can find, in either GitHub or Bugzilla, of "GoToE" actions.
Hence why I've purposely settled for a very simple, and partial, "GoToE" implementation to avoid complicating things initially.[1] In particular, this patch only supports "GoToE" actions that references the /EmbeddedFiles-dict in the PDF document.

See https://web.archive.org/web/20220309040754if_/https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G11.2048909

---
[1] Usually I always prefer having *real-world* test-cases to work with, whenever I'm implementing new features.
This commit is contained in:
Jonas Jenwald 2022-10-03 17:55:13 +02:00
parent 8c59cc72a3
commit ce66fefbff
8 changed files with 97 additions and 3 deletions

View file

@ -80,15 +80,19 @@ class AnnotationFactory {
// Only necessary to prevent the `pdfManager.docBaseUrl`-getter, used
// with certain Annotations, from throwing and thus breaking parsing:
pdfManager.ensureCatalog("baseUrl"),
// Only necessary in the `Catalog.parseDestDictionary`-method,
// when parsing "GoToE" actions:
pdfManager.ensureCatalog("attachments"),
pdfManager.ensureDoc("xfaDatasets"),
collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1,
]).then(([acroForm, baseUrl, xfaDatasets, pageIndex]) =>
]).then(([acroForm, baseUrl, attachments, xfaDatasets, pageIndex]) =>
pdfManager.ensure(this, "_create", [
xref,
ref,
pdfManager,
idFactory,
acroForm,
attachments,
xfaDatasets,
collectFields,
pageIndex,
@ -105,6 +109,7 @@ class AnnotationFactory {
pdfManager,
idFactory,
acroForm,
attachments = null,
xfaDatasets,
collectFields,
pageIndex = -1
@ -130,6 +135,7 @@ class AnnotationFactory {
id,
pdfManager,
acroForm: acroForm instanceof Dict ? acroForm : Dict.empty,
attachments,
xfaDatasets,
collectFields,
pageIndex,
@ -2893,6 +2899,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
destDict: params.dict,
resultObj: this.data,
docBaseUrl: params.pdfManager.docBaseUrl,
docAttachments: params.attachments,
});
}
@ -3221,6 +3228,7 @@ class LinkAnnotation extends Annotation {
destDict: params.dict,
resultObj: this.data,
docBaseUrl: params.pdfManager.docBaseUrl,
docAttachments: params.attachments,
});
}
}