| FoxitPDFSDKforWeb v11.0.5 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
AdditionalAction< T > Class Reference
PDF » actions

An annotation, page object, or (beginning with PDF 1.3) interactive form field may include an entry named "AA" which specifies an additional-actions dictionary (PDF 1.2) that extends the set of events that can trigger the execution of an action. In PDF 1.4, the document catalog dictionary may also contain an "AA" entry for trigger events affecting the document as a whole. More...

## Public Member Functions
async | addAction (triggerEvent:ActionTriggerEvents, actionSpec:ActionSpecification)
| This method allows you to add an action to the specified trigger event type. More...
| getActions< E extends readonly ActionTriggerEvents[]> (triggerEvents?:E)
| Retrieves actions for the specified trigger event type. More...
async | removeAction (triggerEvent:ActionTriggerEvents, targetActionObjNumber?:number)
| Removes action for the specified trigger event type. If the `targetActionObjNumber` is not provided, all actions for the specified trigger event type will be removed. If the `targetActionObjNumber` is provided, only the action with that object number will be removed. More...
async | setAction (triggerEvent:ActionTriggerEvents, actionSpec:ActionSpecification)
| Sets an additional action for specified trigger event type. More...
async | updateActionData (triggerEvent:ActionTriggerEvents, actionObjectNumber:number, actionData:ActionData)
| Updates an existing action data for the specified trigger event type and action object number. This method allows you to modify the data of an existing action. More...

## Detailed Description

An annotation, page object, or (beginning with PDF 1.3) interactive form field may include an entry named "AA" which specifies an additional-actions dictionary (PDF 1.2) that extends the set of events that can trigger the execution of an action. In PDF 1.4, the document catalog dictionary may also contain an "AA" entry for trigger events affecting the document as a whole.

The instance of this class can be retrived from PDFDoc, PDFPage, PDFFormField, Annot (only some types) and can be used to get/set data from an additional-actions dictionary from PDF document, PDF page, PDF form field or PDF annotation.

Notes on trigger event types:
  The applicable trigger event type depends on the source of the additional action:
  - If current additional action is retrived from PDFDoc, the trigger event type should be one of DocActionTriggerEvents.
  - If current additional action is retrived from PDFPage, the trigger event type should be one of PageActionTriggerEvents.
  - If current additional action is retrived from PDFFormField, the trigger event type should be one of FieldActionTriggerEvents.
  - If current additional action is retrived from Screen, the trigger event type should be one of AnnotActionTriggerEvents.
  - If current additional action is retrived from Widget, the trigger event type should be one of AnnotActionTriggerEvents or FieldActionTriggerEvents.

Notes on ActionSpecification
  The action specification object defines the action type and associated data to be executed when the trigger event occurs:
  - If current additional action is retrieved from PDFDoc or PDFFormField, the type of this action should be ActionType.javaScript .
  - If current additional action is retrieved from PDFPage, Annot (Screen, Widget), please refer to comment of the trigger event to check if only specified type of action can be used. Usually, support following types as the new action: ActionType.goto, ActionType.uri, ActionType.javaScript, ActionType.named, ActionType.gotoR, ActionType.gotoE, ActionType.submitForm, ActionType.resetForm, ActionType.hide, ActionType.launch, ActionType.importData, ActionType.rendition

Since
  11.0.0

Template Parameters

  T | - A generic type extending ActionTriggerEvents

See also
  PDFDoc.getAdditionalAction
  PDFFormField.getAdditionalAction
  Widget.getAdditionalAction
  Screen.getAdditionalAction

## Member Function Documentation

## ◆ addAction()

async AdditionalAction< T >::addAction | ( |  | triggerEvent:ActionTriggerEvents,
|  |  | actionSpec:ActionSpecification
| ) |  |
| inline

This method allows you to add an action to the specified trigger event type.

Parameters

  triggerEvent | ActionTriggerEvents - The trigger event type for which the action is to be appended. If there is already an action for the specified trigger event type, the new action will be a sub-action of the existing action. If there is no action for the specified trigger event type, the new action will be set to the AdditionalAction. For details about triggerEvent and actionSpec, please refer to the description of AdditionalAction.
  actionSpec | ActionSpecification - The action specification object that defines the action to be added.

Note
  Currently we don't support to create an embedded goto action (type: ActionType.gotoE).

Since
  11.0.0

## ◆ getActions< E extends readonly ActionTriggerEvents[]>()

AdditionalAction< T >::getActions< E extends readonly ActionTriggerEvents[]> | ( |  | triggerEvents?:E | ) |
| inline

Retrieves actions for the specified trigger event type.

Parameters

  [triggerEvents] | ActionTriggerEvents[] - Optional array of trigger events to filter the actions. If not provided, all supported trigger events will be used.

Returns
  Promise<ActionSpecification[]> - Resolves with the actions associated with the specified trigger events.

Since
  11.0.0

## ◆ removeAction()

async AdditionalAction< T >::removeAction | ( |  | triggerEvent:ActionTriggerEvents,
|  |  | targetActionObjNumber?:number
| ) |  |
| inline

Removes action for the specified trigger event type. If the `targetActionObjNumber` is not provided, all actions for the specified trigger event type will be removed. If the `targetActionObjNumber` is provided, only the action with that object number will be removed.

Parameters

  triggerEvent | ActionTriggerEvents - The trigger event type.
  [targetActionObjNumber] | number - Optional. The specific action object number to be removed. If not provided, all actions for the trigger event will be removed.

Returns
  Promise<boolean> - Resolves to true if the action was successfully removed, false otherwise.

## ◆ setAction()

async AdditionalAction< T >::setAction | ( |  | triggerEvent:ActionTriggerEvents,
|  |  | actionSpec:ActionSpecification
| ) |  |
| inline

Sets an additional action for specified trigger event type.

Note
  For details about triggerEvent and actionSpec, please refer to the description of AdditionalAction.

Parameters

  triggerEvent | ActionTriggerEvents - The trigger event type for which the action is to be set.
  actionSpec | ActionSpecification - The action specification object that defines the action to be set.

Since
  11.0.0

## ◆ updateActionData()

async AdditionalAction< T >::updateActionData | ( |  | triggerEvent:ActionTriggerEvents,
|  |  | actionObjectNumber:number,
|  |  | actionData:ActionData
| ) |  |
| inline

Updates an existing action data for the specified trigger event type and action object number. This method allows you to modify the data of an existing action.

Parameters

  triggerEvent | T - The trigger event type for which the action data is to be updated.
  actionObjectNumber | number - The object number of the action to be updated.
  actionData | ActionData - the data of the action to be updated

Returns
  Promise<void> - Resolves when the action is successfully updated.

Since
  11.0.0

@2025 Foxit Software Incorporated. All rights reserved.