Foxit PDF RDK

Public Member Functions | Static Public Attributes | List of all members
AdditionalAction Class Reference

## Public Member Functions
| constructor (annot)
| Constructor, from a PDF annotation. More...
| constructor (doc, pdf_dict)
| Constructor, from a PDF document or a PDF dictionary (if any). More...
| constructor (field)
| Constructor, from a PDF form field. More...
| constructor (page)
| Constructor, from a PDF page. More...
| DoJSAction (trigger)
| Perform javascript action which is specified by a trigger event type. More...
| GetAction (trigger)
| Get an action with specified trigger event type. More...
| GetDict ()
| Get the PDF dictionary of current object. More...
| IsEmpty ()
| Check whether current object is empty or not. More...
| RemoveAction (trigger)
| Remove an action with specified trigger event type. More...
| RemoveAllActions ()
| Remove all actions. More...
| SetAction (trigger, action)
| Set a additional-action for specified trigger event type. More...

## Static Public Attributes
static | e_TriggerAnnotCursorEnter
| Trigger an action to be performed when the cursor enters the annotation's active area. More...
static | e_TriggerAnnotCursorExit
| Trigger an action to be performed when the cursor exits the annotation's active area. More...
static | e_TriggerAnnotLoseInputFocus
| (Applicable for widget annotation only) Trigger an action to be performed when the annotation loses the input focus. More...
static | e_TriggerAnnotMouseButtonPressed
| Trigger an action to be performed when the mouse button is pressed inside the annotation's active area. More...
static | e_TriggerAnnotMouseButtonReleased
| Trigger an action to be performed when the mouse button is released inside the annotation's active area. More...
static | e_TriggerAnnotPageClosed
| Trigger an action to be performed when the page containing the annotation is closed. More...
static | e_TriggerAnnotPageInvisible
| Trigger an action to be performed when the page containing the annotation is no longer visible in the viewer application's user interface. More...
static | e_TriggerAnnotPageOpened
| Trigger an action to be performed when the page containing the annotation is opened. More...
static | e_TriggerAnnotPageVisible
| Trigger an action to be performed when the page containing the annotation becomes visible in the viewer application's user interface. More...
static | e_TriggerAnnotReceiveInputFocus
| (Applicable for widget annotation only) Trigger an action to be performed when the annotation receives the input focus. More...
static | e_TriggerDocPrinted
| Trigger a JavaScript action to be performed after printing a document. More...
static | e_TriggerDocSaved
| Trigger a JavaScript action to be performed after saving a document. More...
static | e_TriggerDocWillClose
| Trigger a JavaScript action to be performed before closing a document. More...
static | e_TriggerDocWillPrint
| Trigger a JavaScript action to be performed before printing a document. More...
static | e_TriggerDocWillSave
| Trigger a JavaScript action to be performed before saving a document. More...
static | e_TriggerFieldKeyStroke
| Trigger a JavaScript action to be performed when the user types a keystroke into a text field or combo box or modifies the selection in a scrollable list box. More...
static | e_TriggerFieldRecalculateValue
| Trigger a JavaScript action to be performed to recalculate the value of this field when that of another field changes. More...
static | e_TriggerFieldValueChanged
| Trigger a JavaScript action to be performed when the field's value is changed. More...
static | e_TriggerFieldWillFormat
| Trigger a JavaScript action to be performed before the field is formatted to display its current value. More...
static | e_TriggerPageClosed
| Trigger an action to be performed when the page is closed. More...
static | e_TriggerPageOpened
| Enumeration for trigger event. 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.
This class can be constructed from PDF document, PDF page, PDF form field, PDF annotation (only some types) or an existing additional-actions dictionary and can be used to get/set data from an additional-actions dictionary from PDF document, PDF page, PDF form field or PDF annotation.

## Member Function Documentation

## ◆ constructor() [1/4]

AdditionalAction.constructor | ( | annot |  | ) |

Constructor, from a PDF annotation.

Parameters

  [in] | annot | A valid PDF annotation. Currently, only support widget and screen annotation. For other types of annotations, this function will throw exception e_ErrUnsupported.

## ◆ constructor() [2/4]

AdditionalAction.constructor | ( | doc | ,
|  | pdf_dict |
| ) |  |

Constructor, from a PDF document or a PDF dictionary (if any).

Parameters

  [in] | doc | A valid PDF document object.
  [in] | pdf_dict | A PDF dictionary which represents an additional action dictionary. If this parameter is null, that means just to construct an Additional action object with PDF document. If this parameter is not null, that means to construct an Additional action object from this PDF dictionary should have existed in the specified PDF document and represents the additional action dictionary. Default value: null.

## ◆ constructor() [3/4]

AdditionalAction.constructor | ( | field |  | ) |

Constructor, from a PDF form field.

Parameters

  [in] | field | A valid PDF form field.

## ◆ constructor() [4/4]

AdditionalAction.constructor | ( | page |  | ) |

Constructor, from a PDF page.

Parameters

  [in] | page | A valid PDF page object.

## ◆ DoJSAction()

AdditionalAction.DoJSAction | ( | trigger |  | ) |

Perform javascript action which is specified by a trigger event type.

If current object is constructed with a valid PDF dictionary, current function will return false directly because Foxit PDF SDK cannot know which kind of object the additional action dictionary is associated with.

Parameters

  [in] | trigger | The input trigger event type. It should be: If current additional-action is constructed from PDF page, the trigger value must be one of values starting from AdditionalAction.e_TriggerPageOpened (with same prefix name). If current additional-action is constructed from PDF document, the trigger value must be one of values starting from AdditionalAction.e_TriggerDocWillClose (with same prefix name). If current additional-action is constructed from PDF form field, the trigger value must be one of values starting from AdditionalAction.e_TriggerFieldKeyStroke (with same prefix name). If current additional-action is constructed from PDF annotation, the trigger value must be one of values starting from AdditionalAction.e_TriggerAnnotCursorEnter (with same prefix name).

Returns
  true means success , while false means failure or current object is constructed from PDF dictionary.

## ◆ GetAction()

AdditionalAction.GetAction | ( | trigger |  | ) |

Get an action with specified trigger event type.

Parameters

  [in] | trigger | The input trigger event type. It should be: If current additional-action is constructed from PDF dictionary, the trigger value can be one of values defined in enum class TriggerEvent. If current additional-action is constructed from PDF page, the trigger value must be one of values starting from AdditionalAction.e_TriggerPageOpened (with same prefix name). If current additional-action is constructed from PDF document, the trigger value must be one of values starting from AdditionalAction.e_TriggerDocWillClose (with same prefix name). If current additional-action is constructed from PDF form field, the trigger value must be one of values starting from AdditionalAction.e_TriggerFieldKeyStroke (with same prefix name). If current additional-action is constructed from PDF annotation, the trigger value must be one of values starting from AdditionalAction.e_TriggerAnnotCursorEnter (with same prefix name).

Returns
  An action object.

## ◆ GetDict()

AdditionalAction.GetDict | ( |  | ) |

Get the PDF dictionary of current object.

Returns
  The PDF dictionary.If there is any error, this function will return null.

## ◆ IsEmpty()

AdditionalAction.IsEmpty | ( |  | ) |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ RemoveAction()

AdditionalAction.RemoveAction | ( | trigger |  | ) |

Remove an action with specified trigger event type.

If there is no action for input trigger event type when it is valid, this function will return true directly.

Parameters

  [in] | trigger | The input trigger event type. It should be: If current additional-action is constructed from PDF dictionary, the trigger value can be one of values defined in enum class TriggerEvent. If current additional-action is constructed from PDF page, the trigger value must be one of values starting from AdditionalAction.e_TriggerPageOpened (with same prefix name). If current additional-action is constructed from PDF document, the trigger value must be one of values starting from AdditionalAction.e_TriggerDocWillClose (with same prefix name). If current additional-action is constructed from PDF form field, the trigger value must be one of values starting from AdditionalAction.e_TriggerFieldKeyStroke (with same prefix name). If current additional-action is constructed from PDF annotation, the trigger value must be one of values starting from AdditionalAction.e_TriggerAnnotCursorEnter (with same prefix name).

Returns
  true means success , while false means failure.

## ◆ RemoveAllActions()

AdditionalAction.RemoveAllActions | ( |  | ) |

Remove all actions.

Returns
  true means success , while false means failure.

## ◆ SetAction()

AdditionalAction.SetAction | ( | trigger | ,
|  | action |
| ) |  |

Set a additional-action for specified trigger event type.

Parameters

  [in] | trigger | The input trigger event type. It should be: If current additional-action is constructed from PDF dictionary, the trigger value can be one of values defined in enum class TriggerEvent. If current additional-action is constructed from PDF page, the trigger value must be one of values starting from AdditionalAction.e_TriggerPageOpened (with same prefix name). If current additional-action is constructed from PDF document, the trigger value must be one of values starting from AdditionalAction.e_TriggerDocWillClose (with same prefix name). If current additional-action is constructed from PDF form field, the trigger value must be one of values starting from AdditionalAction.e_TriggerFieldKeyStroke (with same prefix name). If current additional-action is constructed from PDF annotation, the trigger value must be one of values starting from AdditionalAction.e_TriggerAnnotCursorEnter (with same prefix name).
  [in] | action | An action object to be set. If current additional-action is constructed from PDF document or PDF form field, the type of this action should be Action.e_TypeJavaScript. If current additional-action is constructed from PDF page, PDF annotation, or PDF dictionary, 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: Action.e_TypeGoto, Action.e_TypeURI, Action.e_TypeJavaScript, Action.e_TypeNamed, Action.e_TypeGoToR, Action.e_TypeGoToE, Action.e_TypeSubmitForm, Action.e_TypeResetForm, Action.e_TypeHide, Action.e_TypeLaunch, Action.e_TypeImportData, Action.e_TypeRendition.

Returns
  None.

## Member Data Documentation

## ◆ e_TriggerAnnotCursorEnter

AdditionalAction.e_TriggerAnnotCursorEnter
| static

Trigger an action to be performed when the cursor enters the annotation's active area.

This represents "E" entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from PDF annotation.

## ◆ e_TriggerAnnotCursorExit

AdditionalAction.e_TriggerAnnotCursorExit
| static

Trigger an action to be performed when the cursor exits the annotation's active area.

This represents "X" entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from PDF annotation.

## ◆ e_TriggerAnnotLoseInputFocus

AdditionalAction.e_TriggerAnnotLoseInputFocus
| static

(Applicable for widget annotation only) Trigger an action to be performed when the annotation loses the input focus.

This represents "Bl" (Uppercase B and lowercase L, which stands for "blurred") entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from a widget annotation.

## ◆ e_TriggerAnnotMouseButtonPressed

AdditionalAction.e_TriggerAnnotMouseButtonPressed
| static

Trigger an action to be performed when the mouse button is pressed inside the annotation's active area.

This represents "D" (stands for "Down") entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from PDF annotation.

## ◆ e_TriggerAnnotMouseButtonReleased

AdditionalAction.e_TriggerAnnotMouseButtonReleased
| static

Trigger an action to be performed when the mouse button is released inside the annotation's active area.

This represents "U" (stands for "Up") entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from PDF annotation.

## ◆ e_TriggerAnnotPageClosed

AdditionalAction.e_TriggerAnnotPageClosed
| static

Trigger an action to be performed when the page containing the annotation is closed.

This represents "PC" entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from PDF annotation. The triggered action is executed after action for AdditionalAction.e_TriggerPageClosed is triggered, if such action present.

## ◆ e_TriggerAnnotPageInvisible

AdditionalAction.e_TriggerAnnotPageInvisible
| static

Trigger an action to be performed when the page containing the annotation is no longer visible in the viewer application's user interface.

This represents "PI" entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from PDF annotation.

## ◆ e_TriggerAnnotPageOpened

AdditionalAction.e_TriggerAnnotPageOpened
| static

Trigger an action to be performed when the page containing the annotation is opened.

This represents "PO" entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from PDF annotation. The triggered action is executed after action for AdditionalAction.e_TriggerPageOpened is triggered and open action of PDF document, if such actions present.

## ◆ e_TriggerAnnotPageVisible

AdditionalAction.e_TriggerAnnotPageVisible
| static

Trigger an action to be performed when the page containing the annotation becomes visible in the viewer application's user interface.

This represents "PV" entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from PDF annotation.

## ◆ e_TriggerAnnotReceiveInputFocus

AdditionalAction.e_TriggerAnnotReceiveInputFocus
| static

(Applicable for widget annotation only) Trigger an action to be performed when the annotation receives the input focus.

This represents "Fo" entry in an annotation's additional-actions dictionary. Only applicable for additional action object constructed from a widget annotation.

## ◆ e_TriggerDocPrinted

AdditionalAction.e_TriggerDocPrinted
| static

Trigger a JavaScript action to be performed after printing a document.

This represents "DP" entry in a document catalog's additional-actions dictionary. Only applicable for additional action object constructed from PDF document.

## ◆ e_TriggerDocSaved

AdditionalAction.e_TriggerDocSaved
| static

Trigger a JavaScript action to be performed after saving a document.

This represents "DS" entry in a document catalog's additional-actions dictionary. Only applicable for additional action object constructed from PDF document.

## ◆ e_TriggerDocWillClose

AdditionalAction.e_TriggerDocWillClose
| static

Trigger a JavaScript action to be performed before closing a document.

This represents "WC" entry in a document catalog's additional-actions dictionary. Only applicable for additional action object constructed from PDF document.

## ◆ e_TriggerDocWillPrint

AdditionalAction.e_TriggerDocWillPrint
| static

Trigger a JavaScript action to be performed before printing a document.

This represents "WP" entry in a document catalog's additional-actions dictionary. Only applicable for additional action object constructed from PDF document.

## ◆ e_TriggerDocWillSave

AdditionalAction.e_TriggerDocWillSave
| static

Trigger a JavaScript action to be performed before saving a document.

This represents "WS" entry in a document catalog's additional-actions dictionary. Only applicable for additional action object constructed from PDF document.

## ◆ e_TriggerFieldKeyStroke

AdditionalAction.e_TriggerFieldKeyStroke
| static

Trigger a JavaScript action to be performed when the user types a keystroke into a text field or combo box or modifies the selection in a scrollable list box.

This represents "K" entry in a form field's additional-actions dictionary. Only applicable for additional action object constructed from PDF form field.
The triggered action can check the keystroke for validity and reject or modify it.

## ◆ e_TriggerFieldRecalculateValue

AdditionalAction.e_TriggerFieldRecalculateValue
| static

Trigger a JavaScript action to be performed to recalculate the value of this field when that of another field changes.

This represents "C" entry in a form field's additional-actions dictionary. Only applicable for additional action object constructed from PDF form field.
The order in which the document's fields are recalculated can be gotten by function Form.GetFieldsInCalculationOrder.

## ◆ e_TriggerFieldValueChanged

AdditionalAction.e_TriggerFieldValueChanged
| static

Trigger a JavaScript action to be performed when the field's value is changed.

This represents "V" entry in a form field's additional-actions dictionary. Only applicable for additional action object constructed from PDF form field.
The triggered action can check the new value for validity.

## ◆ e_TriggerFieldWillFormat

AdditionalAction.e_TriggerFieldWillFormat
| static

Trigger a JavaScript action to be performed before the field is formatted to display its current value.

This represents "F" entry in a form field's additional-actions dictionary. Only applicable for additional action object constructed from PDF form field.
The triggered action can modify the field's value before formatting.

## ◆ e_TriggerPageClosed

AdditionalAction.e_TriggerPageClosed
| static

Trigger an action to be performed when the page is closed.

This represents "C" entry in a page object's additional-actions dictionary. Only applicable for additional action object constructed from PDF page.

## ◆ e_TriggerPageOpened

AdditionalAction.e_TriggerPageOpened
| static

Enumeration for trigger event.

Values of this enumeration should be used alone.

Trigger an action to be performed when the page is opened. This represents "O" entry in a page object's additional-actions dictionary. Only applicable for additional action object constructed from PDF page.