Class: Dispatcher

Actions. Dispatcher

A subclass or mixin that enables many different classes to construct and dispatch PDF Actions.


new Dispatcher()

Creates a dispatcher.

Methods


addAction(trigger, action)

Add a single action to a trigger.

Parameters:
Name Type Description
trigger string

The name of the trigger to which to add the action.

action Actions.Action | object

The action to add, or an object representing the desired properties (including a name)


addActions(actions)

Add the actions to the dispatcher so they run on next trigger, constructing them if necessary

Parameters:
Name Type Description
actions object

The actions to add, as an object with triggers for keys and arrays of action-describing objects for values.


addActionsFromXfdf(widgetElement, pageMatrix)

Read and instantiate actions from XFDF.

Parameters:
Name Type Description
widgetElement Element

The widget element to read from

pageMatrix XODText.Matrix2D

The widget's page's transormation matrix

Deprecated:
  • Due to PDFInfo

getActions()

Get all the actions associated with this dispatcher.

Returns:

The associated actions (in the same format as addActions)

Type
object

getDocumentViewer()

Get the associated DocumentViewer.

Returns:

The associated DocumentViewer instance

Type
CoreControls.DocumentViewer

saveActionsToXfdf(widgetElement, pageMatrix, overrideElement)

Save the actions associated with this Dispatcher to an XFDF DOM element.

Parameters:
Name Type Argument Description
widgetElement Element

The element to which to write the actions

pageMatrix XODText.Matrix2D

The widget's page's transformation matrix

overrideElement Element <nullable>

An optional other element to write to. If not provided, an OnActivation element will be added to widgetElement

Deprecated:
  • Due to PDFInfo

setDocumentViewer(documentViewer)

Set the internal DocumentViewer reference, which is required for some actions to execute correctly.

Parameters:
Name Type Description
documentViewer CoreControls.DocumentViewer

The DocumentViewer instance


triggerAction(trigger, event)

Trigger all the actions associated with the given trigger, passing the event provided.

Parameters:
Name Type Description
trigger string

The trigger to trigger

event Annotations.Forms.PDFJS.Event

The event to pass to each action