Show / Hide Table of Contents

Class Action

Sets the Action that will be triggered when the document is opened.

Inheritance
object
Action
Implements
IDisposable
Inherited Members
object.ToString()
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.MemberwiseClone()
Namespace: pdftron.PDF
Assembly: PDFNet.dll
Syntax
public class Action : IDisposable
Remarks

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.

Constructors

Action(Obj)

A constructor. Creates an Action and initializes it using given Cos/SDF object.

Declaration
public Action(Obj a)
Parameters
Type Name Description
Obj a

Pointer to the Cos/SDF object.

Remarks

The constructor does not copy any data, but is instead the logical equivalent of a type cast.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Methods

CreateGoto(byte[], int, Destination)

Creates a new 'GoTo' action using a 'Named Destination'. GoTo action takes the user to the specified 'Named Destination' view located in the same document.

Declaration
public static Action CreateGoto(byte[] key, int key_sz, Destination dest)
Parameters
Type Name Description
byte[] key

a string buffer representing the destination name. The named destination will be stored in document's '/Dest' SDF::NameTree.

int key_sz

size of the key buffer

Destination dest

The explicit destination used to create the named destination.

Returns
Type Description
Action

the action

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateGoto(string, Destination)

Creates a new 'GoTo' action using a 'Named Destination'. GoTo action takes the user to the specified 'Named Destination' view located in the same document.

Declaration
public static Action CreateGoto(string key, Destination dest)
Parameters
Type Name Description
string key
  • a string buffer representing the destination name. The named destination will be stored in document's '/Dest' SDF::NameTree.
Destination dest

The explicit destination used to create the named destination.

Returns
Type Description
Action

the action

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateGoto(Destination)

Creates a new 'GoTo'action. GoTo action takes the user to the specified Destination view located in the same document.

Declaration
public static Action CreateGoto(Destination dest)
Parameters
Type Name Description
Destination dest

A Destination for the new Action.

Returns
Type Description
Action

the action

Remarks

This method can only be used for destinations in the same document as the source document. For cross-document links use Action::CreateGotoRemote().

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateGotoRemote(FileSpec, int)

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.

Declaration
public static Action CreateGotoRemote(FileSpec file, int page_num)
Parameters
Type Name Description
FileSpec file

The file referred to by the action.

int page_num

A page number within the remote document. The first page is numbered 0.

Returns
Type Description
Action

the action

Remarks

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateGotoRemote(FileSpec, int, bool)

Creates a new 'GoToR'action. See the above method for details.

Declaration
public static Action CreateGotoRemote(FileSpec file, int page_num, bool new_window)
Parameters
Type Name Description
FileSpec file

The file referred to by the action.

int page_num

A page number within the remote document. The first page is numbered 0.

bool new_window

the new_window

Returns
Type Description
Action

the action

Remarks

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateHideField(SDFDoc, List<string>)

Declaration
public static Action CreateHideField(SDFDoc doc, List<string> field_list)
Parameters
Type Name Description
SDFDoc doc
List<string> field_list
Returns
Type Description
Action
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateImportData(SDFDoc, string)

Creates a new 'Import Data' action. An import data action imports form data from a FDF file into a PDF document.

Declaration
public static Action CreateImportData(SDFDoc doc, string path)
Parameters
Type Name Description
SDFDoc doc

the document in which to create the action

string path

the full path of the FDF file

Returns
Type Description
Action

the action

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateJavaScript(SDFDoc, string)

Creates a new 'JavaScript' action. A javascript action executes a JavaScript script when it's invoked.

Declaration
public static Action CreateJavaScript(SDFDoc doc, string script)
Parameters
Type Name Description
SDFDoc doc

the document in which to create the action

string script

the JavaScript script to be executed

Returns
Type Description
Action

the action

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateLaunch(SDFDoc, string)

Creates a new 'Launch' action. A launch action opens up a file using the most appropriate program.

Declaration
public static Action CreateLaunch(SDFDoc doc, string path)
Parameters
Type Name Description
SDFDoc doc

the document in which to create the action

string path

full path of the file to be opened

Returns
Type Description
Action

the action

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateResetForm(SDFDoc)

Creates a new 'Reset Form' action. A reset form action reset choosen form fields to their default value.

Declaration
public static Action CreateResetForm(SDFDoc doc)
Parameters
Type Name Description
SDFDoc doc

the document in which to create the action

Returns
Type Description
Action

the action

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateSubmitForm(FileSpec)

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.

Declaration
public static Action CreateSubmitForm(FileSpec url)
Parameters
Type Name Description
FileSpec url

A URL file specification giving the uniform resource locator (URL) of the script at the Web server that will process the submission.

Returns
Type Description
Action

the action

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateURI(SDFDoc, string)

Create a new URI action. The URL action is typically resolved by opening a URL in the default web browser.

Declaration
public static Action CreateURI(SDFDoc doc, string uri)
Parameters
Type Name Description
SDFDoc doc

The document in which to create the action.

string uri

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
Type Description
Action

the action

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Dispose()

Releases all resources used by the Action

Declaration
public override sealed void Dispose()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Dispose(bool)

Declaration
[HandleProcessCorruptedStateExceptions]
protected virtual void Dispose(bool A_0)
Parameters
Type Name Description
bool A_0
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Equals(object)

Declaration
public override bool Equals(object o)
Parameters
Type Name Description
object o

a given Object

Returns
Type Description
bool

true, if equals to the given object

Overrides
object.Equals(object)
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

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()

Declaration
public void Execute()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

ExecuteKeyStrokeAction(KeyStrokeEventData)

Execute KeyStrokeAction, this 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. This action checks the added text for validity and reject or modify it.

Declaration
public KeyStrokeActionResult ExecuteKeyStrokeAction(KeyStrokeEventData data)
Parameters
Type Name Description
KeyStrokeEventData data

the data that contains previous text, added text, and added position information

Returns
Type Description
KeyStrokeActionResult

the result of KeyStrokeAction.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

~Action()

Declaration
protected ~Action()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetDest()

Gets the dest.

Declaration
public Destination GetDest()
Returns
Type Description
Destination

The Action's Destination view.

Remarks

This only works for Actions whose subtype is "GoTo". All named destinations are automatically resolved to the explicit destination so you can access destination members directly.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetFormActionFlag(FormActionFlag)

Gets the form action flag.

Declaration
public bool GetFormActionFlag(Action.FormActionFlag flag)
Parameters
Type Name Description
Action.FormActionFlag flag

the flag

Returns
Type Description
bool

value of the given action flag.

Action flags are currently only used by submit and reset form actions.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetNext()

Gets the next actions

Declaration
public Obj GetNext()
Returns
Type Description
Obj

The next action dictionary, an array of action dictionaries, or NULL if there are no additional actions.

Remarks

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetSDFObj()

Gets the SDFObj.

Declaration
public Obj GetSDFObj()
Returns
Type Description
Obj

Pointer to the underlying SDF/Cos object.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetType()

Gets the type.

Declaration
public Action.Type GetType()
Returns
Type Description
Action.Type

The type of this Action.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsValid()

Indicates whether the Action is valid (non-null).

Declaration
public bool IsValid()
Returns
Type Description
bool

True if this is a valid (non-null) Action; otherwise false.

Remarks

If this method returns false the underlying SDF/Cos object is null and the Action object should be treated as null as well.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

NeedsWriteLock()

Test whether this action needs WriteLock

Declaration
public bool NeedsWriteLock()
Returns
Type Description
bool

true if it may modify the document, otherwise false.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Set(Action)

Sets value to given Action object

Declaration
public void Set(Action p)
Parameters
Type Name Description
Action p

another Action object

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetFormActionFlag(FormActionFlag, bool)

Set the value of a given field flag.

Action flags are currently only used by submit and reset form actions.

Declaration
public void SetFormActionFlag(Action.FormActionFlag flag, bool value)
Parameters
Type Name Description
Action.FormActionFlag flag

the flag

bool value

the value

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

op_Assign(Action)

Assignment operator

Declaration
public Action op_Assign(Action r)
Parameters
Type Name Description
Action r

another Action object

Returns
Type Description
Action

a Action object equals to the give object

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Operators

operator ==(Action, Action)

Equality operator checks whether two Action objects are the same

Declaration
public static bool operator ==(Action l, Action r)
Parameters
Type Name Description
Action l

Action object on the left of the operator

Action r

Action object on the right of the operator

Returns
Type Description
bool

true if two objects are equal, false otherwise

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

operator !=(Action, Action)

Ineuqality operator checks whether two Action objects are different

Declaration
public static bool operator !=(Action l, Action r)
Parameters
Type Name Description
Action l

Action object on the left of the operator

Action r

Action object on the right of the operator

Returns
Type Description
bool

true if two objects are not equal, false otherwise

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Implements

IDisposable
In This Article
Back to top Generated by DocFX