Foxit PDF SDK
FSAdditionalAction Class Reference
Inheritance diagram for FSAdditionalAction:
FSBase

Instance Methods

(BOOL) - doJSAction:
 Perform javascript action which is specified by a trigger event type.
More...
 
(FSAction *) - getAction:
 Get an action with specified trigger event type.
More...
 
(FSPDFDictionary *) - getDict
 Get the PDF dictionary of current object.
More...
 
(id) - initWithAnnot:
 Constructor, from a PDF annotation.
More...
 
(id) - initWithDoc:pdf_dict:
 Constructor, from a PDF document or a PDF dictionary (if any).
More...
 
(id) - initWithField:
 Constructor, from a PDF form field.
More...
 
(id) - initWithOther:
 Constructor, with another additional action object.
More...
 
(id) - initWithPage:
 Constructor, from a PDF page.
More...
 
(BOOL) - isEmpty
 Check whether current object is empty or not.
More...
 
(BOOL) - removeAction:
 Remove an action with specified trigger event type.
More...
 
(BOOL) - removeAllActions
 Remove all actions.
More...
 
(void) - setAction:action:
 Set a additional-action for specified trigger event type.
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.

Method Documentation

◆ doJSAction:()

- (BOOL) doJSAction: (FSAdditionalActionTriggerEvent 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 NO directly because Foxit PDF SDK cannot know which kind of object the additional action dictionary is associated with.

Parameters
[in]triggerThe input trigger event type. It should be:
Returns
YES means success , while NO means failure or current object is constructed from PDF dictionary.

◆ getAction:()

- (FSAction *) getAction: (FSAdditionalActionTriggerEvent trigger

Get an action with specified trigger event type.

Parameters
[in]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 FSAdditionalActionTriggerPageOpened (with same prefix name).
  • If current additional-action is constructed from PDF document, the trigger value must be one of values starting from FSAdditionalActionTriggerDocWillClose (with same prefix name).
  • If current additional-action is constructed from PDF form field, the trigger value must be one of values starting from FSAdditionalActionTriggerFieldKeyStroke (with same prefix name).
  • If current additional-action is constructed from PDF annotation, the trigger value must be one of values starting from FSAdditionalActionTriggerAnnotCursorEnter (with same prefix name).

Returns
An action object.

◆ getDict()

- (FSPDFDictionary *) getDict

Get the PDF dictionary of current object.

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

◆ initWithAnnot:()

- (id) initWithAnnot: (FSAnnot*)  annot

Constructor, from a PDF annotation.

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

◆ initWithDoc:pdf_dict:()

- (id) initWithDoc: (FSPDFDoc*)  doc
pdf_dict: (FSPDFDictionary*)  pdf_dict 

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

Parameters
[in]docA valid PDF document object.
[in]pdf_dictA PDF dictionary which represents an additional action dictionary. If this parameter is nil, that means just to construct an Additional action object with PDF document. If this parameter is not nil, 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.

◆ initWithField:()

- (id) initWithField: (FSField*)  field

Constructor, from a PDF form field.

Parameters
[in]fieldA valid PDF form field.

◆ initWithOther:()

- (id) initWithOther: (FSAdditionalAction*)  other

Constructor, with another additional action object.

Parameters
[in]otherAnother additional action object.

◆ initWithPage:()

- (id) initWithPage: (FSPDFPage*)  page

Constructor, from a PDF page.

Parameters
[in]pageA valid PDF page object.

◆ isEmpty()

- (BOOL) isEmpty

Check whether current object is empty or not.

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

Returns
YES means current object is empty, while NO means not.

◆ removeAction:()

- (BOOL) removeAction: (FSAdditionalActionTriggerEvent 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 YES directly.

Parameters
[in]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 FSAdditionalActionTriggerPageOpened (with same prefix name).
  • If current additional-action is constructed from PDF document, the trigger value must be one of values starting from FSAdditionalActionTriggerDocWillClose (with same prefix name).
  • If current additional-action is constructed from PDF form field, the trigger value must be one of values starting from FSAdditionalActionTriggerFieldKeyStroke (with same prefix name).
  • If current additional-action is constructed from PDF annotation, the trigger value must be one of values starting from FSAdditionalActionTriggerAnnotCursorEnter (with same prefix name).

Returns
YES means success , while NO means failure.

◆ removeAllActions()

- (BOOL) removeAllActions

Remove all actions.

Returns
YES means success , while NO means failure.

◆ setAction:action:()

- (void) setAction: (FSAdditionalActionTriggerEvent trigger
action: (FSAction*)  action 

Set a additional-action for specified trigger event type.

Parameters
[in]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 FSAdditionalActionTriggerPageOpened (with same prefix name).
  • If current additional-action is constructed from PDF document, the trigger value must be one of values starting from FSAdditionalActionTriggerDocWillClose (with same prefix name).
  • If current additional-action is constructed from PDF form field, the trigger value must be one of values starting from FSAdditionalActionTriggerFieldKeyStroke (with same prefix name).
  • If current additional-action is constructed from PDF annotation, the trigger value must be one of values starting from FSAdditionalActionTriggerAnnotCursorEnter (with same prefix name).

[in]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 FSActionTypeJavaScript.
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:
FSActionTypeGoto, FSActionTypeURI, FSActionTypeJavaScript, FSActionTypeNamed, FSActionTypeGoToR, FSActionTypeGoToE, FSActionTypeSubmitForm, FSActionTypeResetForm, FSActionTypeHide, FSActionTypeLaunch, FSActionTypeImportData, FSActionTypeRendition.
Returns
None.