com.foxit.sdk.pdf.actions.AdditionalAction Class Reference
Inheritance diagram for com.foxit.sdk.pdf.actions.AdditionalAction:
com.foxit.sdk.common.Base

Public Member Functions

 AdditionalAction (PDFDoc doc, PDFDictionary pdf_dict) throws com.foxit.sdk.PDFException
 Constructor, from a PDF document or a PDF dictionary (if any). More...
 
 AdditionalAction (PDFPage page) throws com.foxit.sdk.PDFException
 Constructor, from a PDF page. More...
 
 AdditionalAction (Field field) throws com.foxit.sdk.PDFException
 Constructor, from a PDF form field. More...
 
 AdditionalAction (Annot annot) throws com.foxit.sdk.PDFException
 Constructor, from a PDF annotation. More...
 
 AdditionalAction (AdditionalAction other)
 Constructor, with another AdditionalAction object. More...
 
boolean doJSAction (int trigger) throws com.foxit.sdk.PDFException
 Perform javascript action which is specified by a trigger event type. More...
 
Action getAction (int trigger) throws com.foxit.sdk.PDFException
 Get an action with specified trigger event type. More...
 
PDFDictionary getDict () throws com.foxit.sdk.PDFException
 Get the PDF dictionary of current object. More...
 
boolean isEmpty ()
 Check whether current object is empty or not. More...
 
boolean removeAction (int trigger) throws com.foxit.sdk.PDFException
 Remove an action with specified trigger event type. More...
 
boolean removeAllActions () throws com.foxit.sdk.PDFException
 Remove all actions. More...
 
void setAction (int trigger, Action action) throws com.foxit.sdk.PDFException
 Set a additional-action for specified trigger event type. More...
 

Static Public Attributes

static final int e_TriggerAnnotCursorEnter = 11
 Trigger an action to be performed when the cursor enters the annotation's active area. More...
 
static final int e_TriggerAnnotCursorExit = 12
 Trigger an action to be performed when the cursor exits the annotation's active area. More...
 
static final int e_TriggerAnnotLoseInputFocus = 16
 (Applicable for widget annotation only) Trigger an action to be performed when the annotation loses the input focus. More...
 
static final int e_TriggerAnnotMouseButtonPressed = 13
 Trigger an action to be performed when the mouse button is pressed inside the annotation's active area. More...
 
static final int e_TriggerAnnotMouseButtonReleased = 14
 Trigger an action to be performed when the mouse button is released inside the annotation's active area. More...
 
static final int e_TriggerAnnotPageClosed = 18
 Trigger an action to be performed when the page containing the annotation is closed. More...
 
static final int e_TriggerAnnotPageInvisible = 20
 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 final int e_TriggerAnnotPageOpened = 17
 Trigger an action to be performed when the page containing the annotation is opened. More...
 
static final int e_TriggerAnnotPageVisible = 19
 Trigger an action to be performed when the page containing the annotation becomes visible in the viewer application's user interface. More...
 
static final int e_TriggerAnnotReceiveInputFocus = 15
 (Applicable for widget annotation only) Trigger an action to be performed when the annotation receives the input focus. More...
 
static final int e_TriggerDocPrinted = 6
 Trigger a JavaScript action to be performed after printing a document. More...
 
static final int e_TriggerDocSaved = 4
 Trigger a JavaScript action to be performed after saving a document. More...
 
static final int e_TriggerDocWillClose = 2
 Trigger a JavaScript action to be performed before closing a document. More...
 
static final int e_TriggerDocWillPrint = 5
 Trigger a JavaScript action to be performed before printing a document. More...
 
static final int e_TriggerDocWillSave = 3
 Trigger a JavaScript action to be performed before saving a document. More...
 
static final int e_TriggerFieldKeyStroke = 7
 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 final int e_TriggerFieldRecalculateValue = 10
 Trigger a JavaScript action to be performed to recalculate the value of this field when that of another field changes. More...
 
static final int e_TriggerFieldValueChanged = 9
 Trigger a JavaScript action to be performed when the field's value is changed. More...
 
static final int e_TriggerFieldWillFormat = 8
 Trigger a JavaScript action to be performed before the field is formatted to display its current value. More...
 
static final int e_TriggerPageClosed = 1
 Trigger an action to be performed when the page is closed. More...
 
static final int e_TriggerPageOpened = 0
 Trigger an action to be performed when the page is opened. 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.

Constructor & Destructor Documentation

◆ AdditionalAction() [1/5]

com.foxit.sdk.pdf.actions.AdditionalAction.AdditionalAction ( PDFDoc  doc,
PDFDictionary  pdf_dict 
) throws com.foxit.sdk.PDFException

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

Parameters
docA valid PDF document object.
pdf_dictA 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.

◆ AdditionalAction() [2/5]

com.foxit.sdk.pdf.actions.AdditionalAction.AdditionalAction ( PDFPage  page) throws com.foxit.sdk.PDFException

Constructor, from a PDF page.

Parameters
pageA valid PDF page object.

◆ AdditionalAction() [3/5]

com.foxit.sdk.pdf.actions.AdditionalAction.AdditionalAction ( Field  field) throws com.foxit.sdk.PDFException

Constructor, from a PDF form field.

Parameters
fieldA valid PDF form field.

◆ AdditionalAction() [4/5]

com.foxit.sdk.pdf.actions.AdditionalAction.AdditionalAction ( Annot  annot) throws com.foxit.sdk.PDFException

Constructor, from a PDF annotation.

Parameters
annotA valid PDF annotation. Currently, only support widget and screen annotation. For other types of annotations, this function will throw exception e_ErrUnsupported.

◆ AdditionalAction() [5/5]

com.foxit.sdk.pdf.actions.AdditionalAction.AdditionalAction ( AdditionalAction  other)

Constructor, with another AdditionalAction object.

Parameters
otherAnother AdditionalAction object.

Member Function Documentation

◆ doJSAction()

boolean com.foxit.sdk.pdf.actions.AdditionalAction.doJSAction ( int  trigger) throws com.foxit.sdk.PDFException

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
triggerThe 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 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 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 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 e_TriggerAnnotCursorEnter (with same prefix name).

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

◆ getAction()

Action com.foxit.sdk.pdf.actions.AdditionalAction.getAction ( int  trigger) throws com.foxit.sdk.PDFException

Get an action with specified trigger event type.

Parameters
triggerThe 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 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 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 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 e_TriggerAnnotCursorEnter (with same prefix name).

Returns
An Action object.

◆ getDict()

PDFDictionary com.foxit.sdk.pdf.actions.AdditionalAction.getDict ( ) throws com.foxit.sdk.PDFException

Get the PDF dictionary of current object.

Returns
The PDF dictionary.

◆ isEmpty()

boolean com.foxit.sdk.pdf.actions.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()

boolean com.foxit.sdk.pdf.actions.AdditionalAction.removeAction ( int  trigger) throws com.foxit.sdk.PDFException

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
triggerThe 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 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 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 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 e_TriggerAnnotCursorEnter (with same prefix name).

Returns
true means success , while false means failure.

◆ removeAllActions()

boolean com.foxit.sdk.pdf.actions.AdditionalAction.removeAllActions ( ) throws com.foxit.sdk.PDFException

Remove all actions.

Returns
true means success , while false means failure.

◆ setAction()

void com.foxit.sdk.pdf.actions.AdditionalAction.setAction ( int  trigger,
Action  action 
) throws com.foxit.sdk.PDFException

Set a additional-action for specified trigger event type.

Parameters
triggerThe 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 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 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 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 e_TriggerAnnotCursorEnter (with same prefix name).

actionAn 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 actions::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: actions::e_TypeGoto, actions::e_TypeURI, actions::e_TypeJavaScript, actions::e_TypeNamed, actions::e_TypeGoToR, actions::e_TypeGoToE, actions::e_TypeSubmitForm, actions::e_TypeResetForm, actions::e_TypeHide, actions::e_TypeLaunch, actions::e_TypeImportData, actions::e_TypeRendition.
Returns
None.

Member Data Documentation

◆ e_TriggerAnnotCursorEnter

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotCursorEnter = 11
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 AdditionalAction object constructed from PDF annotation.

◆ e_TriggerAnnotCursorExit

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotCursorExit = 12
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 AdditionalAction object constructed from PDF annotation.

◆ e_TriggerAnnotLoseInputFocus

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotLoseInputFocus = 16
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 AdditionalAction object constructed from a widget annotation.

◆ e_TriggerAnnotMouseButtonPressed

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotMouseButtonPressed = 13
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 AdditionalAction object constructed from PDF annotation.

◆ e_TriggerAnnotMouseButtonReleased

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotMouseButtonReleased = 14
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 AdditionalAction object constructed from PDF annotation.

◆ e_TriggerAnnotPageClosed

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotPageClosed = 18
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 AdditionalAction object constructed from PDF annotation. The triggered action is executed after action for e_TriggerPageClosed is triggered, if such action present.

◆ e_TriggerAnnotPageInvisible

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotPageInvisible = 20
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 AdditionalAction object constructed from PDF annotation.

◆ e_TriggerAnnotPageOpened

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotPageOpened = 17
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 AdditionalAction object constructed from PDF annotation. The triggered action is executed after action for e_TriggerPageOpened is triggered and open action of PDF document, if such actions present.

◆ e_TriggerAnnotPageVisible

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotPageVisible = 19
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 AdditionalAction object constructed from PDF annotation.

◆ e_TriggerAnnotReceiveInputFocus

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerAnnotReceiveInputFocus = 15
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 AdditionalAction object constructed from a widget annotation.

◆ e_TriggerDocPrinted

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerDocPrinted = 6
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 AdditionalAction object constructed from PDF document.

◆ e_TriggerDocSaved

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerDocSaved = 4
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 AdditionalAction object constructed from PDF document.

◆ e_TriggerDocWillClose

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerDocWillClose = 2
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 AdditionalAction object constructed from PDF document.

◆ e_TriggerDocWillPrint

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerDocWillPrint = 5
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 AdditionalAction object constructed from PDF document.

◆ e_TriggerDocWillSave

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerDocWillSave = 3
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 AdditionalAction object constructed from PDF document.

◆ e_TriggerFieldKeyStroke

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerFieldKeyStroke = 7
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 AdditionalAction object constructed from PDF form field.
The triggered action can check the keystroke for validity and reject or modify it.

◆ e_TriggerFieldRecalculateValue

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerFieldRecalculateValue = 10
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 AdditionalAction object constructed from PDF form field.
The order in which the document's fields are recalculated can be gotten by function interform::Form::getFieldsInCalculationOrder.

◆ e_TriggerFieldValueChanged

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerFieldValueChanged = 9
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 AdditionalAction object constructed from PDF form field.
The triggered action can check the new value for validity.

◆ e_TriggerFieldWillFormat

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerFieldWillFormat = 8
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 AdditionalAction object constructed from PDF form field.
The triggered action can modify the field's value before formatting.

◆ e_TriggerPageClosed

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerPageClosed = 1
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 AdditionalAction object constructed from PDF page.

◆ e_TriggerPageOpened

static final int com.foxit.sdk.pdf.actions.AdditionalAction.e_TriggerPageOpened = 0
static

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 AdditionalAction object constructed from PDF page.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.