Table of Contents

Class PdfAction

Namespace
iText.Kernel.Pdf.Action
Assembly
itext.kernel.dll

A wrapper for action dictionaries (ISO 32000-1 section 12.6).

public class PdfAction : PdfObjectWrapper<PdfDictionary>
Inheritance
PdfAction
Inherited Members

Remarks

A wrapper for action dictionaries (ISO 32000-1 section 12.6). An action dictionary defines the characteristics and behaviour of an action.

Constructors

PdfAction()

Constructs an empty action that can be further modified.

public PdfAction()

PdfAction(PdfDictionary)

Constructs a PdfAction instance with a given dictionary.

public PdfAction(PdfDictionary pdfObject)

Parameters

pdfObject PdfDictionary

the dictionary to construct the wrapper around

Remarks

Constructs a PdfAction instance with a given dictionary. It can be used for handy property reading in reading mode or modifying in stamping mode.

Fields

RESET_EXCLUDE

A possible submit value

public const int RESET_EXCLUDE = 1

Field Value

int

SUBMIT_CANONICAL_FORMAT

A possible submit value

public const int SUBMIT_CANONICAL_FORMAT = 512

Field Value

int

SUBMIT_COORDINATES

A possible submit value

public const int SUBMIT_COORDINATES = 16

Field Value

int

SUBMIT_EMBED_FORM

A possible submit value

public const int SUBMIT_EMBED_FORM = 8196

Field Value

int

SUBMIT_EXCLUDE

A possible submit value

public const int SUBMIT_EXCLUDE = 1

Field Value

int

SUBMIT_EXCL_F_KEY

A possible submit value

public const int SUBMIT_EXCL_F_KEY = 2048

Field Value

int

SUBMIT_EXCL_NON_USER_ANNOTS

A possible submit value

public const int SUBMIT_EXCL_NON_USER_ANNOTS = 1024

Field Value

int

SUBMIT_HTML_FORMAT

A possible submit value

public const int SUBMIT_HTML_FORMAT = 4

Field Value

int

SUBMIT_HTML_GET

A possible submit value

public const int SUBMIT_HTML_GET = 8

Field Value

int

SUBMIT_INCLUDE_ANNOTATIONS

A possible submit value

public const int SUBMIT_INCLUDE_ANNOTATIONS = 128

Field Value

int

SUBMIT_INCLUDE_APPEND_SAVES

A possible submit value

public const int SUBMIT_INCLUDE_APPEND_SAVES = 64

Field Value

int

SUBMIT_INCLUDE_NO_VALUE_FIELDS

A possible submit value

public const int SUBMIT_INCLUDE_NO_VALUE_FIELDS = 2

Field Value

int

SUBMIT_PDF

A possible submit value

public const int SUBMIT_PDF = 256

Field Value

int

SUBMIT_XFDF

A possible submit value

public const int SUBMIT_XFDF = 32

Field Value

int

Methods

CreateGoTo(string)

Creates a GoTo action (section 12.6.4.2 of ISO 32000-1) via a given PdfStringDestination name.

public static PdfAction CreateGoTo(string destination)

Parameters

destination string

PdfStringDestination name

Returns

PdfAction

created action

CreateGoTo(PdfDestination)

Creates a GoTo action (section 12.6.4.2 of ISO 32000-1) via a given destination.

public static PdfAction CreateGoTo(PdfDestination destination)

Parameters

destination PdfDestination

the desired destination of the action

Returns

PdfAction

created action

CreateGoToE(PdfFileSpec, PdfDestination, bool, PdfTarget)

Creates a GoToE action, or embedded file action (section 12.6.4.4 of ISO 32000-1).

public static PdfAction CreateGoToE(PdfFileSpec fileSpec, PdfDestination destination, bool newWindow, PdfTarget targetDictionary)

Parameters

fileSpec PdfFileSpec

The root document of the target relative to the root document of the source

destination PdfDestination

the destination in the target to jump to

newWindow bool

if true, the destination document should be opened in a new window; if false, the destination document should replace the current document in the same window

targetDictionary PdfTarget

A target dictionary specifying path information to the target document. Each target dictionary specifies one element in the full path to the target and may have nested target dictionaries specifying additional elements

Returns

PdfAction

created action

CreateGoToE(PdfDestination, bool, PdfTarget)

Creates a GoToE action, or embedded file action (section 12.6.4.4 of ISO 32000-1).

public static PdfAction CreateGoToE(PdfDestination destination, bool newWindow, PdfTarget targetDictionary)

Parameters

destination PdfDestination

the destination in the target to jump to

newWindow bool

if true, the destination document should be opened in a new window; if false, the destination document should replace the current document in the same window

targetDictionary PdfTarget

A target dictionary specifying path information to the target document. Each target dictionary specifies one element in the full path to the target and may have nested target dictionaries specifying additional elements

Returns

PdfAction

created action

CreateGoToR(string, int)

Creates a GoToR action, or remote action (section 12.6.4.3 of ISO 32000-1).

public static PdfAction CreateGoToR(string filename, int pageNum)

Parameters

filename string

the remote destination file to jump to

pageNum int

the remote destination document page to jump to

Returns

PdfAction

created action

CreateGoToR(string, int, bool)

Creates a GoToR action, or remote action (section 12.6.4.3 of ISO 32000-1).

public static PdfAction CreateGoToR(string filename, int pageNum, bool newWindow)

Parameters

filename string

the remote destination file to jump to

pageNum int

the remote destination document page to jump to

newWindow bool

a flag specifying whether to open the destination document in a new window

Returns

PdfAction

created action

CreateGoToR(string, string)

Creates a GoToR action, or remote action (section 12.6.4.3 of ISO 32000-1).

public static PdfAction CreateGoToR(string filename, string destination)

Parameters

filename string

the remote destination file to jump to

destination string

the string destination in the remote document to jump to

Returns

PdfAction

created action

CreateGoToR(string, string, bool)

Creates a GoToR action, or remote action (section 12.6.4.3 of ISO 32000-1).

public static PdfAction CreateGoToR(string filename, string destination, bool newWindow)

Parameters

filename string

the remote destination file to jump to

destination string

the string destination in the remote document to jump to

newWindow bool

a flag specifying whether to open the destination document in a new window

Returns

PdfAction

created action

CreateGoToR(PdfFileSpec, PdfDestination)

Creates a GoToR action, or remote action (section 12.6.4.3 of ISO 32000-1).

public static PdfAction CreateGoToR(PdfFileSpec fileSpec, PdfDestination destination)

Parameters

fileSpec PdfFileSpec

the file in which the destination shall be located

destination PdfDestination

the destination in the remote document to jump to

Returns

PdfAction

created action

CreateGoToR(PdfFileSpec, PdfDestination, bool)

Creates a GoToR action, or remote action (section 12.6.4.3 of ISO 32000-1).

public static PdfAction CreateGoToR(PdfFileSpec fileSpec, PdfDestination destination, bool newWindow)

Parameters

fileSpec PdfFileSpec

the file in which the destination shall be located

destination PdfDestination

the destination in the remote document to jump to

newWindow bool

a flag specifying whether to open the destination document in a new window

Returns

PdfAction

created action

CreateHide(string, bool)

Creates a Hide action (section 12.6.4.10 of ISO 32000-1).

public static PdfAction CreateHide(string text, bool hidden)

Parameters

text string

a text string giving the fully qualified field name of an interactive form field whose associated widget annotation or annotations are to be affected

hidden bool

a flag indicating whether to hide the annotation (true) or show it (false)

Returns

PdfAction

created action

CreateHide(string[], bool)

Creates a Hide action (section 12.6.4.10 of ISO 32000-1).

public static PdfAction CreateHide(string[] text, bool hidden)

Parameters

text string[]

a text string array giving the fully qualified field names of interactive form fields whose associated widget annotation or annotations are to be affected

hidden bool

a flag indicating whether to hide the annotation (true) or show it (false)

Returns

PdfAction

created action

CreateHide(PdfAnnotation, bool)

Creates a Hide action (section 12.6.4.10 of ISO 32000-1).

public static PdfAction CreateHide(PdfAnnotation annotation, bool hidden)

Parameters

annotation PdfAnnotation

the annotation to be hidden or shown

hidden bool

a flag indicating whether to hide the annotation (true) or show it (false)

Returns

PdfAction

created action

CreateHide(PdfAnnotation[], bool)

Creates a Hide action (section 12.6.4.10 of ISO 32000-1).

public static PdfAction CreateHide(PdfAnnotation[] annotations, bool hidden)

Parameters

annotations PdfAnnotation[]

the annotations to be hidden or shown

hidden bool

a flag indicating whether to hide the annotation (true) or show it (false)

Returns

PdfAction

created action

CreateJavaScript(string)

Creates a JavaScript action (section 12.6.4.16 of ISO 32000-1).

public static PdfAction CreateJavaScript(string javaScript)

Parameters

javaScript string

a text string containing the JavaScript script to be executed.

Returns

PdfAction

created action

CreateLaunch(PdfFileSpec)

Creates a Launch action (section 12.6.4.5 of ISO 32000-1).

public static PdfAction CreateLaunch(PdfFileSpec fileSpec)

Parameters

fileSpec PdfFileSpec

the application that shall be launched or the document that shall beopened or printed

Returns

PdfAction

created action

CreateLaunch(PdfFileSpec, bool)

Creates a Launch action (section 12.6.4.5 of ISO 32000-1).

public static PdfAction CreateLaunch(PdfFileSpec fileSpec, bool newWindow)

Parameters

fileSpec PdfFileSpec

the application that shall be launched or the document that shall beopened or printed

newWindow bool

a flag specifying whether to open the destination document in a new window

Returns

PdfAction

created action

CreateMovie(PdfAnnotation, string, PdfName)

Creates a Movie annotation (section 12.6.4.9 of ISO 32000-1).

public static PdfAction CreateMovie(PdfAnnotation annotation, string title, PdfName operation)

Parameters

annotation PdfAnnotation

a movie annotation identifying the movie that shall be played

title string

the title of a movie annotation identifying the movie that shall be played

operation PdfName

the operation that shall be performed on the movie. Shall be one of the following: Play , Stop , Pause , Resume

Returns

PdfAction

created annotation

Remarks

Creates a Movie annotation (section 12.6.4.9 of ISO 32000-1). Deprecated in PDF 2.0.

CreateNamed(PdfName)

Creates a Named action (section 12.6.4.11 of ISO 32000-1).

public static PdfAction CreateNamed(PdfName namedAction)

Parameters

namedAction PdfName

the name of the action that shall be performed. Shall be one of the following: NextPage , PrevPage , FirstPage , LastPage

Returns

PdfAction

created action

CreateRendition(string, PdfFileSpec, string, PdfAnnotation)

Creates a Rendition action (section 12.6.4.13 of ISO 32000-1).

public static PdfAction CreateRendition(string file, PdfFileSpec fileSpec, string mimeType, PdfAnnotation screenAnnotation)

Parameters

file string

the name of the media clip, for use in the user interface.

fileSpec PdfFileSpec

a full file specification or form XObject that specifies the actual media data

mimeType string

an ASCII string identifying the type of data

screenAnnotation PdfAnnotation

a screen annotation

Returns

PdfAction

created action

CreateResetForm(object[], int)

Creates a Reset-Form Action (section 12.7.5.3 of ISO 32000-1).

public static PdfAction CreateResetForm(object[] names, int flags)

Parameters

names object[]

an array identifying which fields to reset or which to exclude from resetting, depending on the setting of the Include/Exclude flag in the Flags entry (see Table 239 of ISO 32000-1).

flags int

a set of flags specifying various characteristics of the action (see Table 239 of ISO 32000-1). Default value to be passed: 0.

Returns

PdfAction

created action

CreateSetOcgState(IList<PdfActionOcgState>)

Creates a Set-OCG-State action (section 12.6.4.12 of ISO 32000-1).

public static PdfAction CreateSetOcgState(IList<PdfActionOcgState> states)

Parameters

states IList<PdfActionOcgState>

a list of PdfActionOcgState state descriptions

Returns

PdfAction

created action

CreateSetOcgState(IList<PdfActionOcgState>, bool)

Creates a Set-OCG-State action (section 12.6.4.12 of ISO 32000-1).

public static PdfAction CreateSetOcgState(IList<PdfActionOcgState> states, bool preserveRb)

Parameters

states IList<PdfActionOcgState>

states a list of PdfActionOcgState state descriptions

preserveRb bool

If true, indicates that radio-button state relationships between optional content groups should be preserved when the states are applied

Returns

PdfAction

created action

CreateSound(PdfStream)

Creates a Sound action (section 12.6.4.8 of ISO 32000-1).

public static PdfAction CreateSound(PdfStream sound)

Parameters

sound PdfStream

a sound object defining the sound that shall be played (see section 13.3 of ISO 32000-1)

Returns

PdfAction

created action

Remarks

Creates a Sound action (section 12.6.4.8 of ISO 32000-1). Deprecated in PDF 2.0.

CreateSound(PdfStream, float, bool, bool, bool)

Creates a Sound action (section 12.6.4.8 of ISO 32000-1).

public static PdfAction CreateSound(PdfStream sound, float volume, bool synchronous, bool repeat, bool mix)

Parameters

sound PdfStream

a sound object defining the sound that shall be played (see section 13.3 of ISO 32000-1)

volume float

the volume at which to play the sound, in the range -1.0 to 1.0. Default value: 1.0

synchronous bool

a flag specifying whether to play the sound synchronously or asynchronously. If this flag is true, the conforming reader retains control, allowing no further user interaction other than canceling the sound, until the sound has been completely played. Default value: false

repeat bool

a flag specifying whether to repeat the sound indefinitely If this entry is present, the Synchronous entry shall be ignored. Default value: false

mix bool

a flag specifying whether to mix this sound with any other sound already playing

Returns

PdfAction

created action

Remarks

Creates a Sound action (section 12.6.4.8 of ISO 32000-1). Deprecated in PDF 2.0.

CreateSubmitForm(string, object[], int)

Creates a Submit-Form Action (section 12.7.5.2 of ISO 32000-1).

public static PdfAction CreateSubmitForm(string file, object[] names, int flags)

Parameters

file string

a uniform resource locator, as described in 7.11.5, "URL Specifications"

names object[]

an array identifying which fields to include in the submission or which to exclude, depending on the setting of the Include/Exclude flag in the Flags entry. This is an optional parameter and can be null

flags int

a set of flags specifying various characteristics of the action (see Table 237 of ISO 32000-1). Default value to be passed: 0.

Returns

PdfAction

created action

CreateThread(PdfFileSpec)

Creates a Thread action (section 12.6.4.6 of ISO 32000-1).

public static PdfAction CreateThread(PdfFileSpec fileSpec)

Parameters

fileSpec PdfFileSpec

the file containing the thread. If this entry is absent, the thread is in the current file

Returns

PdfAction

created action

Remarks

Creates a Thread action (section 12.6.4.6 of ISO 32000-1). A thread action jumps to a specified bead on an article thread (see 12.4.3, "Articles"), in either the current document or a different one. Table 205 shows the action dictionary entries specific to this type of action.

CreateThread(PdfFileSpec, PdfObject, PdfObject)

Creates a Thread action (section 12.6.4.6 of ISO 32000-1).

public static PdfAction CreateThread(PdfFileSpec fileSpec, PdfObject destinationThread, PdfObject bead)

Parameters

fileSpec PdfFileSpec

the file containing the thread. If this entry is absent, the thread is in the current file

destinationThread PdfObject

the destination thread

bead PdfObject

the bead in the destination thread

Returns

PdfAction

created action

Remarks

Creates a Thread action (section 12.6.4.6 of ISO 32000-1). A thread action jumps to a specified bead on an article thread (see 12.4.3, "Articles"), in either the current document or a different one. Table 205 shows the action dictionary entries specific to this type of action.

CreateURI(string)

Creates a URI action (section 12.6.4.7 of ISO 32000-1).

public static PdfAction CreateURI(string uri)

Parameters

uri string

the uniform resource identifier to resolve

Returns

PdfAction

created action

CreateURI(string, bool)

Creates a URI action (section 12.6.4.7 of ISO 32000-1).

public static PdfAction CreateURI(string uri, bool isMap)

Parameters

uri string

the uniform resource identifier to resolve

isMap bool

a flag specifying whether to track the mouse position when the URI is resolved

Returns

PdfAction

created action

CreateURI(Uri)

Creates a GoTo action (section 12.6.4.2 of ISO 32000-1) via a given uri.

public static PdfAction CreateURI(Uri uri)

Parameters

uri Uri

the uniform resource identifier to resolve

Returns

PdfAction

created action

Flush()

To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference.

public override void Flush()

Remarks

To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly call MakeIndirect(PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.

IsWrappedObjectMustBeIndirect()

protected override bool IsWrappedObjectMustBeIndirect()

Returns

bool

Next(PdfAction)

Adds a chained action.

public virtual void Next(PdfAction nextAction)

Parameters

nextAction PdfAction

the next action or sequence of actions that shall be performed after the current action

Put(PdfName, PdfObject)

Inserts the value into the underlying object of this PdfAction and associates it with the specified key.

public virtual PdfAction Put(PdfName key, PdfObject value)

Parameters

key PdfName

key to insert or to override

value PdfObject

the value to associate with the specified key

Returns

PdfAction

this PdfAction instance

Remarks

Inserts the value into the underlying object of this PdfAction and associates it with the specified key. If the key is already present in this PdfAction , this method will override the old value with the specified one.

SetAdditionalAction(PdfObjectWrapper<PdfDictionary>, PdfName, PdfAction)

Adds an additional action to the provided PdfObjectWrapper<T> < PdfDictionary

wrapper.

public static void SetAdditionalAction(PdfObjectWrapper<PdfDictionary> wrapper, PdfName key, PdfAction action)

Parameters

wrapper PdfObjectWrapper<PdfDictionary>

the wrapper to add an additional action to

key PdfName

a PdfName specifying the name of an additional action

action PdfAction

the PdfAction to add as an additional action