JavaScript Module

Fields

kA3DPDFEventAutomatic
kA3DPDFEventPageOpened
kA3DPDFEventPageClosed
kA3DPDFEventPageVisible
kA3DPDFEventPageInvisible
kA3DPDFEventFieldEnter
kA3DPDFEventFieldExit
kA3DPDFEventFieldMouseDown
kA3DPDFEventFieldMouseUp
kA3DPDFEventFieldFocusIn
kA3DPDFEventFieldFocusOut
kA3DPDFEventDocWillClose
kA3DPDFEventDocWillSave
kA3DPDFEventDocDidSave
kA3DPDFEventDocWillPrint
kA3DPDFEventDocDidPrint
kA3DPDFEventFieldKeyStroke

Detailed Description

group a3d_pdf_javascript_module

(HOOPS Publish Advanced) Functions for setting JavaScript code on PDF entities.

This module describes the functions and structures that allow you to define JavaScript code on PDF entities, such as Document, Page, 3D annot, or Fields.

Type Documentation

enum A3DPDFEEventActionType

Set of events that can trigger the execution of an action.

The kA3DPDFEventPageOpened and kA3DPDFEventPageClosed event on an annotation object have a similar function in the page object. However, associating these triggers with annotations allows annotation objects to be self-contained. The kA3DPDFEventPageVisible and kA3DPDFEventPageInvisible types allow a distinction between pages that are open and pages that are visible. At any one time, while more than one page may be visible, depending on the page layout.

Version
9.0

Values:

enumerator kA3DPDFEventAutomatic

The action is performed when an event (automatically determined depending on the function called) is triggered. See documentation for function using this.

enumerator kA3DPDFEventPageOpened

An action that shall be performed when the page, or the page containing the annotation, is opened.

enumerator kA3DPDFEventPageClosed

An action that shall be performed when the page, or the page containing the annotation, is closed.

enumerator kA3DPDFEventPageVisible

An action that shall be performed when the page containing the annotation becomes visible.

enumerator kA3DPDFEventPageInvisible

An action that shall be performed when the page containing the annotation is no longer visible in the conforming reader’s user interface.

enumerator kA3DPDFEventFieldEnter

An action that shall be performed when the cursor enters the annotation’s active area.

enumerator kA3DPDFEventFieldExit

An action that shall be performed when the cursor exits the annotation’s active area.

enumerator kA3DPDFEventFieldMouseDown

An action that shall be performed when the mouse button is pressed inside the annotation’s active area.

enumerator kA3DPDFEventFieldMouseUp

An action that shall be performed when the mouse button is released inside the annotation’s active area.

enumerator kA3DPDFEventFieldFocusIn

An action that shall be performed when the annotation receives the input focus.

enumerator kA3DPDFEventFieldFocusOut

An action that shall be performed when the annotation loses the input focus.

enumerator kA3DPDFEventDocWillClose

An action that shall be performed before closing a document.

enumerator kA3DPDFEventDocWillSave

An action that shall be performed before saving a document.

enumerator kA3DPDFEventDocDidSave

An action that shall be performed after saving a document.

enumerator kA3DPDFEventDocWillPrint

An action that shall be performed before printing a document.

enumerator kA3DPDFEventDocDidPrint

An action that shall be performed after printing a document.

enumerator kA3DPDFEventFieldKeyStroke

An action that shall be performed when the user modifies a character in a text field or combo box or modifies the selection in a scrollable list box.

Function Documentation

A3DStatus A3DPDFDocumentAddJavascriptFromString(A3DPDFDocument *pDoc, const A3DUTF8Char *pcScriptName, const A3DUTF8Char *pcJavascriptString)

Adds JavaScript to a document. This JavaScript is launched when the file is opened.

Version
4.3

Parameters:
  • pDoc[inout] The Document object to work with.
  • pcScriptName[in] The name of the script. It is not used by Acrobat but needs to be unique.
  • pcJavascriptString[in] The string which contains the JavaScript.
Return values:

A3D_SUCCESS

Returns:

A3D_SUCCESS in case of success or an error code

A3DStatus A3DPDFPageFieldSetActionJavascriptFromString(A3DPDFPage *pPage, const A3DUTF8Char *pcFieldName, const A3DUTF8Char *pcJavascriptString)

Function to attach JavaScript to a form field. The JavaScript is defined as a string.

The goal of this function is to define a JavaScript action to be launched on an event. The action event is different depending on the type of the field. For fields of type:

  • dropdown list: the action is the selection of a list item.
  • listbox list: the action is the selection of a list item.
  • button: the action is the button pushed.
Version
4.1

Parameters:
  • pPage[inout] The Page object to work with.
  • pcFieldName[in] The name of the form field. Only Acroform fields are supported.
  • pcJavascriptString[in] The string which contains the JavaScript.
Return values:

A3D_SUCCESS

Returns:

A3D_SUCCESS in case of success or an error code

A3DStatus A3DPDFPageFieldSetActionJavascript(A3DPDFPage *pPage, const A3DUTF8Char *pcFieldName, const A3DPDFEEventActionType eEventActionType, const A3DUTF8Char *pcJavascriptString)

Function to attach JavaScript to a form field. The JavaScript is defined as a string.

The goal of this function is to define a JavaScript action to be launched on an event. The action event is different depending on the type of the field. For fields of type:

  • dropdown list: the action is the selection of a list item.
  • listbox list: the action is the selection of a list item.
  • button: the action is the button pushed.
Version
9.0

Parameters:
  • pPage[inout] The Page object to work with.
  • pcFieldName[in] The name of the form field. Only Acroform fields are supported.
  • eEventActionType[in] The action type. Only kA3DPDFEventPageOpened and kA3DPDFEventPageClosed are relevant at page level.
  • pcJavascriptString[in] The string which contains the JavaScript.
Return values:

A3D_SUCCESS

Returns:

A3D_SUCCESS in case of success or an error code

A3DStatus A3DPDFDocumentSetActionJavascript(A3DPDFDocument *pDoc, const A3DPDFEEventActionType eEventActionType, const A3DUTF8Char *pcJavascriptString)

Function to define a javaScript action to an event triggered on the document. The JavaScript is defined as a string.

The goal of this function is to define a JavaScript action to be launched on an event triggered on the document level.

Version
9.0

Parameters:
Return values:

A3D_SUCCESS

Returns:

A3D_SUCCESS in case of success or an error code

A3DStatus A3DPDFPageSetActionJavascript(A3DPDFPage *pPage, const A3DPDFEEventActionType eEventActionType, const A3DUTF8Char *pcJavascriptString)

Function to define a javaScript action to an event triggered on the page. The JavaScript is defined as a string.

The goal of this function is to define a JavaScript action to be launched on an event triggered on the page level.

Version
9.0

Parameters:
  • pPage[in] The Page object to work with.
  • eEventActionType[in] The action type. Only kA3DPDFEventPageOpened and kA3DPDFEventPageClosed are relevant at page level.
  • pcJavascriptString[in] The string which contains the JavaScript.
Return values:

A3D_SUCCESS

Returns:

A3D_SUCCESS in case of success or an error code

A3DStatus A3DPDF3DAnnotSetActionJavascript(A3DPDFPage *pPage, A3DPDF3DAnnot *p3DAnnot, const A3DPDFEEventActionType eEventActionType, const A3DUTF8Char *pcJavascriptString)

Function to define a javaScript action to an event triggered on an annotation. The JavaScript is defined as a string.

The goal of this function is to define a JavaScript action to be launched on an event triggered on an annotation.

Version
9.0

Parameters:
  • pPage[in] The Page object to work with.
  • p3DAnnot[in] The 3D annot object to work with.
  • eEventActionType[in] The action type.
  • pcJavascriptString[in] The string which contains the JavaScript.
Return values:

A3D_SUCCESS

Returns:

A3D_SUCCESS in case of success or an error code