Table of Contents

Class PdfAction

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

A PdfAction defines an action that can be triggered from a PDF file. @see PdfDictionary

public class PdfAction : PdfDictionary
Inheritance
PdfAction
Inherited Members

Constructors

PdfAction()

Create an empty action.

public PdfAction()

PdfAction(int)

Constructs a new PdfAction of Subtype GoToR.

public PdfAction(int named)

Parameters

named int

the named destination to go to

PdfAction(string)

Constructs a new PdfAction of Subtype URI.

public PdfAction(string url)

Parameters

url string

the url to go to

PdfAction(string, bool)

public PdfAction(string url, bool isMap)

Parameters

url string
isMap bool

PdfAction(string, int)

public PdfAction(string filename, int page)

Parameters

filename string
page int

PdfAction(string, string)

Constructs a new PdfAction of Subtype GoTo.

public PdfAction(string filename, string name)

Parameters

filename string
name string

PdfAction(string, string, string, string)

Launchs an application or a document. It can be null . "print" - Print a document. It can be null . It can be null .

public PdfAction(string application, string parameters, string operation, string defaultDir)

Parameters

application string

the application to be launched or the document to be opened or printed.

parameters string

(Windows-specific) A parameter string to be passed to the application.

operation string

(Windows-specific) the operation to perform: "open" - Open a document,

defaultDir string

(Windows-specific) the default directory in standard DOS syntax.

PdfAction(Uri)

Constructs a new PdfAction of Subtype URI.

public PdfAction(Uri url)

Parameters

url Uri

the Url to go to

PdfAction(Uri, bool)

public PdfAction(Uri url, bool isMap)

Parameters

url Uri
isMap bool

Fields

FIRSTPAGE

A named action to go to the first page.

public const int FIRSTPAGE = 1

Field Value

int

LASTPAGE

A named action to go to the last page.

public const int LASTPAGE = 4

Field Value

int

NEXTPAGE

A named action to go to the next page.

public const int NEXTPAGE = 3

Field Value

int

PREVPAGE

A named action to go to the previous page.

public const int PREVPAGE = 2

Field Value

int

PRINTDIALOG

A named action to open a print dialog.

public const int PRINTDIALOG = 5

Field Value

int

RESET_EXCLUDE

a possible submitvalue

public const int RESET_EXCLUDE = 1

Field Value

int

SUBMIT_CANONICAL_FORMAT

a possible submitvalue

public const int SUBMIT_CANONICAL_FORMAT = 512

Field Value

int

SUBMIT_COORDINATES

public const int SUBMIT_COORDINATES = 16

Field Value

int

SUBMIT_EMBED_FORM

a possible submitvalue

public const int SUBMIT_EMBED_FORM = 8196

Field Value

int

SUBMIT_EXCLUDE

constructors

public const int SUBMIT_EXCLUDE = 1

Field Value

int

SUBMIT_EXCL_F_KEY

a possible submitvalue

public const int SUBMIT_EXCL_F_KEY = 2048

Field Value

int

SUBMIT_EXCL_NON_USER_ANNOTS

a possible submitvalue

public const int SUBMIT_EXCL_NON_USER_ANNOTS = 1024

Field Value

int

SUBMIT_HTML_FORMAT

public const int SUBMIT_HTML_FORMAT = 4

Field Value

int

SUBMIT_HTML_GET

public const int SUBMIT_HTML_GET = 8

Field Value

int

SUBMIT_INCLUDE_ANNOTATIONS

a possible submitvalue

public const int SUBMIT_INCLUDE_ANNOTATIONS = 128

Field Value

int

SUBMIT_INCLUDE_APPEND_SAVES

a possible submitvalue

public const int SUBMIT_INCLUDE_APPEND_SAVES = 64

Field Value

int

SUBMIT_INCLUDE_NO_VALUE_FIELDS

public const int SUBMIT_INCLUDE_NO_VALUE_FIELDS = 2

Field Value

int

SUBMIT_PDF

a possible submitvalue

public const int SUBMIT_PDF = 256

Field Value

int

SUBMIT_XFDF

a possible submitvalue

public const int SUBMIT_XFDF = 32

Field Value

int

Methods

CreateHide(object[], bool)

public static PdfAction CreateHide(object[] names, bool hide)

Parameters

names object[]
hide bool

Returns

PdfAction

CreateHide(string, bool)

public static PdfAction CreateHide(string name, bool hide)

Parameters

name string
hide bool

Returns

PdfAction

CreateHide(PdfAnnotation, bool)

public static PdfAction CreateHide(PdfAnnotation annot, bool hide)

Parameters

annot PdfAnnotation
hide bool

Returns

PdfAction

CreateImportData(string)

public static PdfAction CreateImportData(string file)

Parameters

file string

Returns

PdfAction

CreateLaunch(string, string, string, string)

Launchs an application or a document. It can be null . "print" - Print a document. It can be null . It can be null .

public static PdfAction CreateLaunch(string application, string parameters, string operation, string defaultDir)

Parameters

application string

the application to be launched or the document to be opened or printed.

parameters string

(Windows-specific) A parameter string to be passed to the application.

operation string

(Windows-specific) the operation to perform: "open" - Open a document,

defaultDir string

(Windows-specific) the default directory in standard DOS syntax.

Returns

PdfAction

a Launch action

CreateResetForm(object[], int)

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

Parameters

names object[]
flags int

Returns

PdfAction

CreateSubmitForm(string, object[], int)

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

Parameters

file string
names object[]
flags int

Returns

PdfAction

GotoEmbedded(string, PdfTargetDictionary, string, bool, bool)

Creates a GoToE action to an embedded file.

public static PdfAction GotoEmbedded(string filename, PdfTargetDictionary target, string dest, bool isName, bool newWindow)

Parameters

filename string

the root document of the target (null if the target is in the same document)

target PdfTargetDictionary
dest string

the named destination

isName bool

if true sets the destination as a name, if false sets it as a String

newWindow bool

Returns

PdfAction

a GoToE action

GotoEmbedded(string, PdfTargetDictionary, PdfObject, bool)

Creates a GoToE action to an embedded file.

public static PdfAction GotoEmbedded(string filename, PdfTargetDictionary target, PdfObject dest, bool newWindow)

Parameters

filename string

the root document of the target (null if the target is in the same document)

target PdfTargetDictionary

a path to the target document of this action

dest PdfObject

the destination inside the target document, can be of type PdfDestination, PdfName, or PdfString

newWindow bool

if true, the destination document should be opened in a new window

Returns

PdfAction

a GoToE action

GotoLocalPage(int, PdfDestination, PdfWriter)

Creates a GoTo action to an internal page.

public static PdfAction GotoLocalPage(int page, PdfDestination dest, PdfWriter writer)

Parameters

page int

the page to go. First page is 1

dest PdfDestination

the destination for the page

writer PdfWriter

the writer for this action

Returns

PdfAction

a GoTo action

GotoLocalPage(string, bool)

Creates a GoTo action to a named destination.

public static PdfAction GotoLocalPage(string dest, bool isName)

Parameters

dest string

the named destination

isName bool

if true sets the destination as a name, if false sets it as a String

Returns

PdfAction

a GoToR action

GotoRemotePage(string, string, bool, bool)

Creates a GoToR action to a named destination.

public static PdfAction GotoRemotePage(string filename, string dest, bool isName, bool newWindow)

Parameters

filename string

the file name to go to

dest string

the destination name

isName bool

if true sets the destination as a name, if false sets it as a String

newWindow bool

open the document in a new window if true , if false the current document is replaced by the new document.

Returns

PdfAction

a GoToR action

JavaScript(string, PdfWriter)

Creates a JavaScript action. If the JavaScript is smaller than 50 characters it will be place as a string, otherwise it will be placed as a compressed stream.

public static PdfAction JavaScript(string code, PdfWriter writer)

Parameters

code string

the JavaScript code

writer PdfWriter

the writer for this action

Returns

PdfAction

the JavaScript action

JavaScript(string, PdfWriter, bool)

Creates a JavaScript action. If the JavaScript is smaller than 50 characters it will be placed as a string, otherwise it will be placed as a compressed stream. Acrobat JavaScript engine does not support unicode, so this may or may not work for you

public static PdfAction JavaScript(string code, PdfWriter writer, bool unicode)

Parameters

code string

the JavaScript code

writer PdfWriter

the writer for this action

unicode bool

select JavaScript unicode. Note that the internal

Returns

PdfAction

the JavaScript action

Next(PdfAction)

Add a chained action.

public void Next(PdfAction na)

Parameters

na PdfAction

the next action

Rendition(string, PdfFileSpecification, string, PdfIndirectReference)

Creates a Rendition action @throws IOException

public static PdfAction Rendition(string file, PdfFileSpecification fs, string mimeType, PdfIndirectReference refi)

Parameters

file string
fs PdfFileSpecification
mimeType string
refi PdfIndirectReference

Returns

PdfAction

a Media Clip action

SetOcGstate(IList<object>, bool)

A set-OCG-state action (PDF 1.5) sets the state of one or more optional content groups. or String (ON, OFF, or Toggle) followed by one or more optional content group dictionaries PdfLayer or a PdfIndirectReference to a PdfLayer . The array elements are processed from left to right; each name is applied to the subsequent groups until the next name is encountered: ON sets the state of subsequent groups to ON OFF sets the state of subsequent groups to OFF Toggle reverses the state of subsequent groups content groups (as specified by the RBGroups entry in the current configuration dictionary) should be preserved when the states in the state array are applied. That is, if a group is set to ON (either by ON or Toggle) during processing of the state array, any other groups belong to the same radio-button group are turned OFF. If a group is set to OFF, there is no effect on other groups. If false , radio-button state relationships, if any, are ignored

public static PdfAction SetOcGstate(IList<object> state, bool preserveRb)

Parameters

state IList<object>

an array consisting of any number of sequences beginning with a PdfName

preserveRb bool

if true , indicates that radio-button state relationships between optional

Returns

PdfAction

the action