Namespace: Actions

Core. Actions

The namespace for anything to do with PDF actions and action dispatch. Actions can be defined by providing a JavaScript object that has the desired properties, and a name property defining the action subtype it represents. See documentation for specific action types for allowable properties.

Classes

Action
Dest
GoTo
GoToR
Hide
JavaScript
Named
ResetForm
SubmitForm
URI

Mixins

Dispatcher

Members


<static> OnTriggeredAdditionalOptions

Additional options passed to the onTriggered handler.
Properties:
Name Type Description
originalOnTriggered Core.Actions.ActionOnTriggeredHandler The original onTriggered function of this action
action Core.Actions.Action The action that is being triggered

Methods


<static> setCustomOnTriggeredHandler(actionClass, onTriggeredHandler)

Sets a custom handler function that will be called when an action of the specified type is triggered.
Parameters:
Name Type Description
actionClass Core.Actions.Action The class (constructor) of the action
onTriggeredHandler Core.Actions.CustomActionOnTriggeredHandler A handler function that will be called when an action of the specified type is triggered
Example
Actions.setCustomOnTriggeredHandler(Actions.URI, (target, event, documentViewer, options) => {
   if (target instanceof Annotations.Link) {
   // Don't do anything if the action is triggered by a link
     return;
   }
   options.originalOnTriggered(target, event, documentViewer)
});

Type Definitions


ActionOnTriggeredHandler(target, event, documentViewer)

The onTriggered function for actions.
Parameters:
Name Type Description
target Core.Annotations.Forms.Field | Core.DocumentViewer The dispatcher to which this action is attached
event Core.Annotations.Forms.PDFJS.Event The embedded JS event that is used when executing the action
documentViewer Core.DocumentViewer The DocumentViewer to use as context for the action execution

ActionOptions

Options for creating an action
Type:
  • Object
Properties:
Name Type Argument Description
name string <optional>
The action name

CustomActionOnTriggeredHandler(target, event, documentViewer, options)

Handler function that gets passed to Core.Actions.setCustomOnTriggeredHandler. The signature is similar to onTriggered except with an additional options parameter.
Parameters:
Name Type Description
target Core.Annotations.Forms.Field | Core.DocumentViewer The object that the action has been triggered on
event Core.Annotations.Forms.PDFJS.Event The embedded JS event that is used when executing the action
documentViewer Core.DocumentViewer The DocumentViewer to use as context for the action execution
options Core.Actions.OnTriggeredAdditionalOptions Additional options and parameters
Properties
Name Type Description
action Core.Actions.Action The action object that is being triggered
originalOnTriggered Core.Actions.ActionOnTriggeredHandler The original onTriggered function of this action

DestOptions

Options for creating a Dest
Type:
  • Object
Properties:
Name Type Argument Description
page number <optional>
The page number for the destination
fit 'XYZ' | 'FitBH' | 'FitH' | 'FitBV' | 'FitV' | 'FitR' | 'Fit' | 'FitB' <optional>
The fit style
top number <optional>
The top coordinate
left number <optional>
The left coordinate
bottom number <optional>
The bottom coordinate
right number <optional>
The right coordinate
zoom number <optional>
The zoom level
name string <optional>
The named destination name

DestShape

Shape for Dest properties
Type:
  • Object
Properties:
Name Type Argument Description
page number | string <optional>
The page number or name
fit string | number <optional>
The fit style
top number <optional>
The top coordinate
left number <optional>
The left coordinate
bottom number <optional>
The bottom coordinate
right number <optional>
The right coordinate
zoom number | string <optional>
The zoom level
name string <optional>
The named destination name

GoToOptions

Options for creating a GoTo action
Type:
  • Object
Properties:
Name Type Argument Description
dest Core.Actions.DestOptions The destination
name string <optional>
The action name

GoToROptions

Options for creating a GoToR action
Type:
  • Object
Properties:
Name Type Argument Description
dest Core.Actions.DestOptions The destination in the remote document
filename string The filename of the remote document
newWindow boolean Whether to open the remote document in a new window
name string <optional>
The action name

HideOptions

Options for creating a Hide action
Type:
  • Object
Properties:
Name Type Argument Description
fields Array.<string> The field names to show or hide
hide boolean Whether to hide the fields
name string <optional>
The action name

HideShape

Shape for Hide action properties
Type:
  • Object
Properties:
Name Type Argument Description
hide boolean Whether to hide the fields
name string The action name
fields Array.<string> <optional>
The field names

JavaScriptOptions

Options for creating a JavaScript action
Type:
  • Object
Properties:
Name Type Argument Description
javascript string The JavaScript code to execute
name string <optional>
The action name

NamedOptions

Options for creating a Named action
Type:
  • Object
Properties:
Name Type Argument Description
action string The named action (NextPage, PrevPage, FirstPage, LastPage, or Print)
name string <optional>
The action name

ResetFormOptions

Options for creating a ResetForm action
Type:
  • Object
Properties:
Name Type Argument Description
fields Array.<string> The field names to reset
exclude boolean Whether to exclude the fields from being reset
name string <optional>
The action name

ResetFormShape

Shape for ResetForm action properties
Type:
  • Object
Properties:
Name Type Argument Description
exclude boolean Whether to exclude the fields
name string The action name
fields Array.<string> <optional>
The field names

SubmitFormOptions

Options for creating a SubmitForm action
Type:
  • Object
Properties:
Name Type Argument Description
flags Array.<string> The submission flags
name string <optional>
The action name
url string <optional>
The URL to submit the form to
fields Array.<string> <optional>
The field names to include or exclude
format 'fdf' | 'html' | 'xfdf' <optional>
The format to use for submission
includeEmpty boolean <optional>
Whether to include empty fields
method 'POST' | 'GET' <optional>
The HTTP method to use
exclude boolean <optional>
Whether to exclude the specified fields

SubmitFormShape

Shape for SubmitForm action properties
Type:
  • Object
Properties:
Name Type Argument Description
name string The action name
url string <optional>
The URL to submit to
fields Array.<string> <optional>
The field names
format string <optional>
The submission format
includeEmpty boolean <optional>
Whether to include empty fields
method string <optional>
The HTTP method
exclude boolean <optional>
Whether to exclude the fields
flags Array.<string> <optional>
The submission flags

URIOptions

Options for creating a URI action
Type:
  • Object
Properties:
Name Type Argument Description
uri string The URI to open
name string <optional>
The action name