JS - Collect and execute actions at doc and pages level

* the goal is to execute actions like Open or OpenAction
 * can be tested with issue6106.pdf (auto-print)
 * once #12701 is merged, we can add page actions
This commit is contained in:
Calixte Denizet 2020-12-07 19:22:14 +01:00
parent 142f131ee1
commit 1e2173f038
18 changed files with 829 additions and 125 deletions

View file

@ -14,6 +14,7 @@
*/
import { Color } from "./color.js";
import { createActionsMap } from "./common.js";
import { PDFObject } from "./pdf_object.js";
class Field extends PDFObject {
@ -72,7 +73,7 @@ class Field extends PDFObject {
// Private
this._document = data.doc;
this._actions = this._createActionsMap(data.actions);
this._actions = createActionsMap(data.actions);
this._fillColor = data.fillColor || ["T"];
this._strokeColor = data.strokeColor || ["G", 0];
@ -133,16 +134,6 @@ class Field extends PDFObject {
this._send({ id: this._id, focus: true });
}
_createActionsMap(actions) {
const actionsMap = new Map();
if (actions) {
for (const [eventType, actionsForEvent] of Object.entries(actions)) {
actionsMap.set(eventType, actionsForEvent);
}
}
return actionsMap;
}
_isButton() {
return false;
}