new Action()
Actions are typically what happens when a user clicks on a link or bookmark.
Instead of simply jumping to a destination in the document, an annotation or
outline item can specify an action for the viewer application to perform, such
as launching an application, playing a sound, or changing an annotation's
appearance state.
Note: Although the Action class provides utility functions for most commonly used
action types, it is possible to read, write, and edit any action type using SDF API
and dictionary entries described in Section 8.5 in the PDF Reference Manual.
Members
-
<static> FormActionFlag
-
Type:
- number
Properties:
Name Type Description e_exclude
number e_include_no_value_fields
number e_export_format
number e_get_method
number e_submit_coordinates
number e_xfdf
number e_include_append_saves
number e_include_annotations
number e_submit_pdf
number e_canonical_format
number e_excl_non_user_annots
number e_excl_F_key
number e_embed_form
number -
<static> Type
-
Type:
- number
Properties:
Name Type Description e_GoTo
number e_GoToR
number e_GoToE
number e_Launch
number e_Thread
number e_URI
number e_Sound
number e_Movie
number e_Hide
number e_Named
number e_SubmitForm
number e_ResetForm
number e_ImportData
number e_JavaScript
number e_SetOCGState
number e_Rendition
number e_Trans
number e_GoTo3DView
number e_RichMediaExecute
number e_Unknown
number
Methods
-
<static> create( [in_obj])
-
A constructor. Creates an Action and initializes it using given Cos/SDF object.
Parameters:
Name Type Argument Description in_obj
PDFNet.Obj <optional>
Pointer to the Cos/SDF object. Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast. Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createGoto(dest)
-
Creates a new 'GoTo'action. GoTo action takes the user to the specified Destination view located in the same document.
Parameters:
Name Type Description dest
PDFNet.Destination A Destination for the new Action. Note: This method can only be used for destinations in the same document as the source document. For cross-document links use Action::CreateGotoRemote(). Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createGotoRemote(file, page_num)
-
Creates a new 'GoToR'action. A remote go-to action is similar to an ordinary go-to action but jumps to a destination in another PDF file instead of the current file.
Parameters:
Name Type Description file
PDFNet.FileSpec The file referred to by the action. page_num
number A page number within the remote document. The first page is numbered 0. Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createGotoRemoteSetNewWindow(file, page_num, new_window)
-
Creates a new 'GoToR'action. See the above method for details.
Parameters:
Name Type Description file
PDFNet.FileSpec The file referred to by the action. page_num
number A page number within the remote document. The first page is numbered 0. new_window
boolean A flag specifying whether to open the destination document in a new window. If new_window is false, the destination document replaces the current document in the same window, otherwise the viewer application should behave in accordance with the current user preference. Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createGotoWithKey(key, dest)
-
Parameters:
Name Type Description key
string dest
PDFNet.Destination Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createHideField(sdfdoc, field_names_list)
-
Creates a new 'Show/Hide Field' action. A show/hide field action shows or hide certain fields when it's invoked.
Parameters:
Name Type Description sdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the document in which to create the action field_names_list
Array.<string> the list of fields to hide Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createImportData(sdfdoc, path)
-
Creates a new 'Import Data' action. An import data action imports form data from a FDF file into a PDF document.
Parameters:
Name Type Description sdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the document in which to create the action path
string the full path of the FDF file Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createJavaScript(sdfdoc, script)
-
Creates a new 'JavaScript' action. A javascript action executes a JavaScript script when it's invoked.
Parameters:
Name Type Description sdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the document in which to create the action script
string the JavaScript script to be executed Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createLaunch(sdfdoc, path)
-
Creates a new 'Launch' action. A launch action opens up a file using the most appropriate program.
Parameters:
Name Type Description sdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the document in which to create the action path
string the full path of the file to be opened Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createResetForm(sdfdoc)
-
Creates a new 'Reset Form' action. A reset form action reset chosen form fields to their default value.
Parameters:
Name Type Description sdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the document in which to create the action Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createSubmitForm(url)
-
Creates a new 'SubmitForm'action. A submit-form action transmits the names and values of selected interactive form fields to a specified uniform resource locator (URL), presumably the address of a Web server that will process them and send back a response.
Parameters:
Name Type Description url
PDFNet.FileSpec A URL file specification giving the uniform resource locator (URL) of the script at the Web server that will process the submission. Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createURI(sdfdoc, uri)
-
Create a new URI action. The URI action is typically resolved by opening a URL in the default web browser.
Parameters:
Name Type Description sdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc The document in which to create the action. uri
string The uniform resource identifier to resolve, encoded in 7-bit ASCII. A uniform resource identifier (URI) is a string that identifies (resolves to) a resource on the Internet; typically a file that is the destination of a hypertext link, although it can also resolve to a query or other entity. (URIs are described in Internet RFC 2396, Uniform Resource Identifiers (URI). Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
<static> createURIWithUString(sdfdoc, uri)
-
Create a new URI action. The URI action is typically resolved by opening a URL in the default web browser.
Parameters:
Name Type Description sdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc The document in which to create the action. uri
string The uniform resource identifier to resolve, encoded in UTF-8. A uniform resource identifier (URI) is a string that identifies (resolves to) a resource on the Internet; typically a file that is the destination of a hypertext link, although it can also resolve to a query or other entity. (URIs are described in Internet RFC 2396, Uniform Resource Identifiers (URI). Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
compare(in_action)
-
Compares two Action objects for equality.
Parameters:
Name Type Description in_action
PDFNet.Action A reference to an existing Action object. Returns:
A promise that resolves to true if the both Actions share the same underlying SDF/Cos object; otherwise false.- Type
- Promise.<boolean>
-
copy()
-
Copy Constructor
Returns:
A promise that resolves to an object of type: "PDFNet.Action"- Type
- Promise.<PDFNet.Action>
-
execute()
-
Executes current action; this will only work for some action types that can be executed only using the information contained in the action object or the associated PDF doc. See also PDFViewCtrl::ExecuteAction()
Returns:
- Type
- Promise.<void>
-
executeKeyStrokeAction(data)
-
Executes KeyStrokeAction, this shall be performed when the user modifies a character in a text field or combo box or modifies the selecton in a scrollable list box. This action checks the added text for validity and reject or modify it.
Parameters:
Name Type Description data
PDFNet.KeyStrokeEventData Data that contains previous text, added text,and added position information. Returns:
A promise that resolves to an object of type: "PDFNet.KeyStrokeActionResult"- Type
- Promise.<PDFNet.KeyStrokeActionResult>
-
getDest()
-
Returns:
A promise that resolves to the Action's Destination view. Note: This only works for Actions whose subtype is "GoTo". Note: All named destinations are automatically resolved to the explicit destination so you can access destination members directly.- Type
- Promise.<PDFNet.Destination>
-
getFormActionFlag(flag)
-
Parameters:
Name Type Description flag
number PDFNet.Action.FormActionFlag = { e_exclude : 0 e_include_no_value_fields : 1 e_export_format : 2 e_get_method : 3 e_submit_coordinates : 4 e_xfdf : 5 e_include_append_saves : 6 e_include_annotations : 7 e_submit_pdf : 8 e_canonical_format : 9 e_excl_non_user_annots : 10 e_excl_F_key : 11 e_embed_form : 13 }
Action flag to get the value from.Returns:
A promise that resolves to boolean value of the given action flag. Note: Action flags are currently only used by submit and reset form actions.- Type
- Promise.<boolean>
-
getNext()
-
Returns:
A promise that resolves to the next action dictionary, an array of action dictionaries, or NULL if there are no additional actions. Sequences of actions can be chained together. For example, the effect of clicking a link annotation with the mouse might be to play a sound, jump to a new page, and start up a movie. Note that the Next entry is not restricted to a single action but may contain an array of actions, each of which in turn may have a Next entry of its own. The actions may thus form a tree instead of a simple linked list. Actions within each Next array are executed in order, each followed in turn by any actions specified in its Next entry, and so on recursively.- Type
- Promise.<PDFNet.Obj>
-
getSDFObj()
-
Returns:
A promise that resolves to pointer to the underlying SDF/Cos object.- Type
- Promise.<PDFNet.Obj>
-
getType()
-
Returns:
A promise that resolves to the type of this Action.- Type
- Promise.<number>
Example
Return value enum: <pre> PDFNet.Action.Type = { e_GoTo : 0 e_GoToR : 1 e_GoToE : 2 e_Launch : 3 e_Thread : 4 e_URI : 5 e_Sound : 6 e_Movie : 7 e_Hide : 8 e_Named : 9 e_SubmitForm : 10 e_ResetForm : 11 e_ImportData : 12 e_JavaScript : 13 e_SetOCGState : 14 e_Rendition : 15 e_Trans : 16 e_GoTo3DView : 17 e_RichMediaExecute : 18 e_Unknown : 19 } </pre>
-
getXFDF()
-
Returns:
A promise that resolves to an object of type: "string"- Type
- Promise.<string>
-
isValid()
-
Indicates whether the Action is valid (non-null).
Returns:
A promise that resolves to true if this is a valid (non-null) Action; otherwise false. Note: If this method returns false the underlying SDF/Cos object is null and the Action object should be treated as null as well.- Type
- Promise.<boolean>
-
needsWriteLock()
-
Test if the action needs writeLock
Returns:
A promise that resolves to ture if needs, otherwise false- Type
- Promise.<boolean>
-
parameterCreateWithAnnot(annot)
-
Parameters:
Name Type Description annot
PDFNet.Annot Returns:
A promise that resolves to an object of type: "PDFNet.ActionParameter"- Type
- Promise.<PDFNet.ActionParameter>
-
parameterCreateWithField(field)
-
Parameters:
Name Type Description field
PDFNet.Field Returns:
A promise that resolves to an object of type: "PDFNet.ActionParameter"- Type
- Promise.<PDFNet.ActionParameter>
-
parameterCreateWithPage(page)
-
Parameters:
Name Type Description page
PDFNet.Page Returns:
A promise that resolves to an object of type: "PDFNet.ActionParameter"- Type
- Promise.<PDFNet.ActionParameter>
-
setFormActionFlag(flag, value)
-
Set the value of a given field flag.
Parameters:
Name Type Description flag
number PDFNet.Action.FormActionFlag = { e_exclude : 0 e_include_no_value_fields : 1 e_export_format : 2 e_get_method : 3 e_submit_coordinates : 4 e_xfdf : 5 e_include_append_saves : 6 e_include_annotations : 7 e_submit_pdf : 8 e_canonical_format : 9 e_excl_non_user_annots : 10 e_excl_F_key : 11 e_embed_form : 13 }
Action flag to get the value from.value
boolean Boolean to set the value of the flag to. Action flags are currently only used by submit and reset form actions. Returns:
- Type
- Promise.<void>