Show / Hide Table of Contents

Class 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.

Inheritance
System.Object
Action
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: pdftron.PDF
Assembly: PDFTronDotNet.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(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

CreateGoto(Byte[], Int32, 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
System.Byte[] key

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

System.Int32 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
System.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

CreateGotoRemote(FileSpec, Int32)

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.

System.Int32 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, Int32, Boolean)

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.

System.Int32 page_num

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

System.Boolean 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>)

Creates a new Show/Hide Field action. A show/hide field action shows or hide certain fields when it's invoked.

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

the document in which to create the action

System.Collections.Generic.List<System.String> field_list

list of fields to hide

Returns
Type Description
Action

the action

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

System.String path

the full path of the FDF file

Returns
Type Description
Action

the action

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

System.String script

the JavaScript script to be executed

Returns
Type Description
Action

the action

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

System.String path

full path of the file to be opened

Returns
Type Description
Action

the action

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

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.

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

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Equals(Object)

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

a given Object

Returns
Type Description
System.Boolean

true, if equals to the given object

Overrides
System.Object.Equals(System.Object)

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

Finalize()

Releases all resources used by the Action

Declaration
protected void Finalize()

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(Action.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
System.Boolean

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.

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
System.Boolean

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

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

Set(Action)

Sets value to given Action object

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

another Action object

SetFormActionFlag(Action.FormActionFlag, Boolean)

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

System.Boolean value

the value

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Operators

Equality(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
System.Boolean

true if two objects are equal, false otherwise

Inequality(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
System.Boolean

true if two objects are not equal, false otherwise

Implements

System.IDisposable
Back to top Generated by DocFX