com.lowagie.text.pdf

Class PdfAction

public class PdfAction extends PdfDictionary

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

See Also: PdfDictionary

Field Summary
static intFIRSTPAGE
A named action to go to the first page.
static intLASTPAGE
A named action to go to the last page.
static intNEXTPAGE
A named action to go to the next page.
static intPREVPAGE
A named action to go to the previous page.
static intPRINTDIALOG
A named action to open a print dialog.
static intRESET_EXCLUDE
a possible submitvalue
static intSUBMIT_CANONICAL_FORMAT
a possible submitvalue
static intSUBMIT_COORDINATES
a possible submitvalue
static intSUBMIT_EMBED_FORM
a possible submitvalue
static intSUBMIT_EXCLUDE
a possible submitvalue
static intSUBMIT_EXCL_F_KEY
a possible submitvalue
static intSUBMIT_EXCL_NON_USER_ANNOTS
a possible submitvalue
static intSUBMIT_HTML_FORMAT
a possible submitvalue
static intSUBMIT_HTML_GET
a possible submitvalue
static intSUBMIT_INCLUDE_ANNOTATIONS
a possible submitvalue
static intSUBMIT_INCLUDE_APPEND_SAVES
a possible submitvalue
static intSUBMIT_INCLUDE_NO_VALUE_FIELDS
a possible submitvalue
static intSUBMIT_PDF
a possible submitvalue
static intSUBMIT_XFDF
a possible submitvalue
Constructor Summary
PdfAction()
Create an empty action.
PdfAction(URL url)
Constructs a new PdfAction of Subtype URI.
PdfAction(URL url, boolean isMap)
Construct a new PdfAction of Subtype URI that accepts the x and y coordinate of the position that was clicked.
PdfAction(String url)
Constructs a new PdfAction of Subtype URI.
PdfAction(String url, boolean isMap)
Construct a new PdfAction of Subtype URI that accepts the x and y coordinate of the position that was clicked.
PdfAction(PdfIndirectReference destination)
Constructs a new PdfAction of Subtype GoTo.
PdfAction(String filename, String name)
Constructs a new PdfAction of Subtype GoToR.
PdfAction(String filename, int page)
Constructs a new PdfAction of Subtype GoToR.
PdfAction(int named)
Implements name actions.
PdfAction(String application, String parameters, String operation, String defaultDir)
Launchs an application or a document.
Method Summary
static PdfArraybuildArray(Object[] names)
static PdfActioncreateHide(PdfObject obj, boolean hide)
A Hide action hides or shows an object.
static PdfActioncreateHide(PdfAnnotation annot, boolean hide)
A Hide action hides or shows an annotation.
static PdfActioncreateHide(String name, boolean hide)
A Hide action hides or shows an annotation.
static PdfActioncreateHide(Object[] names, boolean hide)
A Hide action hides or shows objects.
static PdfActioncreateImportData(String file)
Creates an Import field.
static PdfActioncreateLaunch(String application, String parameters, String operation, String defaultDir)
Launchs an application or a document.
static PdfActioncreateResetForm(Object[] names, int flags)
Creates a resetform.
static PdfActioncreateSubmitForm(String file, Object[] names, int flags)
Creates a submit form.
static PdfActiongotoEmbedded(String filename, PdfTargetDictionary target, String dest, boolean isName, boolean newWindow)
Creates a GoToE action to an embedded file.
static PdfActiongotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow)
Creates a GoToE action to an embedded file.
static PdfActiongotoLocalPage(int page, PdfDestination dest, PdfWriter writer)
Creates a GoTo action to an internal page.
static PdfActiongotoLocalPage(String dest, boolean isName)
Creates a GoTo action to a named destination.
static PdfActiongotoRemotePage(String filename, String dest, boolean isName, boolean newWindow)
Creates a GoToR action to a named destination.
static PdfActionjavaScript(String code, PdfWriter writer, boolean unicode)
Creates a JavaScript action.
static PdfActionjavaScript(String code, PdfWriter writer)
Creates a JavaScript action.
voidnext(PdfAction na)
Add a chained action.
static PdfActionrendition(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref)
Creates a Rendition action
static PdfActionsetOCGstate(ArrayList state, boolean preserveRB)
A set-OCG-state action (PDF 1.5) sets the state of one or more optional content groups.

Field Detail

FIRSTPAGE

public static final int FIRSTPAGE
A named action to go to the first page.

LASTPAGE

public static final int LASTPAGE
A named action to go to the last page.

NEXTPAGE

public static final int NEXTPAGE
A named action to go to the next page.

PREVPAGE

public static final int PREVPAGE
A named action to go to the previous page.

PRINTDIALOG

public static final int PRINTDIALOG
A named action to open a print dialog.

RESET_EXCLUDE

public static final int RESET_EXCLUDE
a possible submitvalue

SUBMIT_CANONICAL_FORMAT

public static final int SUBMIT_CANONICAL_FORMAT
a possible submitvalue

SUBMIT_COORDINATES

public static final int SUBMIT_COORDINATES
a possible submitvalue

SUBMIT_EMBED_FORM

public static final int SUBMIT_EMBED_FORM
a possible submitvalue

SUBMIT_EXCLUDE

public static final int SUBMIT_EXCLUDE
a possible submitvalue

SUBMIT_EXCL_F_KEY

public static final int SUBMIT_EXCL_F_KEY
a possible submitvalue

SUBMIT_EXCL_NON_USER_ANNOTS

public static final int SUBMIT_EXCL_NON_USER_ANNOTS
a possible submitvalue

SUBMIT_HTML_FORMAT

public static final int SUBMIT_HTML_FORMAT
a possible submitvalue

SUBMIT_HTML_GET

public static final int SUBMIT_HTML_GET
a possible submitvalue

SUBMIT_INCLUDE_ANNOTATIONS

public static final int SUBMIT_INCLUDE_ANNOTATIONS
a possible submitvalue

SUBMIT_INCLUDE_APPEND_SAVES

public static final int SUBMIT_INCLUDE_APPEND_SAVES
a possible submitvalue

SUBMIT_INCLUDE_NO_VALUE_FIELDS

public static final int SUBMIT_INCLUDE_NO_VALUE_FIELDS
a possible submitvalue

SUBMIT_PDF

public static final int SUBMIT_PDF
a possible submitvalue

SUBMIT_XFDF

public static final int SUBMIT_XFDF
a possible submitvalue

Constructor Detail

PdfAction

public PdfAction()
Create an empty action.

PdfAction

public PdfAction(URL url)
Constructs a new PdfAction of Subtype URI.

Parameters: url the Url to go to

PdfAction

public PdfAction(URL url, boolean isMap)
Construct a new PdfAction of Subtype URI that accepts the x and y coordinate of the position that was clicked.

Parameters: url isMap

PdfAction

public PdfAction(String url)
Constructs a new PdfAction of Subtype URI.

Parameters: url the url to go to

PdfAction

public PdfAction(String url, boolean isMap)
Construct a new PdfAction of Subtype URI that accepts the x and y coordinate of the position that was clicked.

Parameters: url isMap

PdfAction

PdfAction(PdfIndirectReference destination)
Constructs a new PdfAction of Subtype GoTo.

Parameters: destination the destination to go to

PdfAction

public PdfAction(String filename, String name)
Constructs a new PdfAction of Subtype GoToR.

Parameters: filename the file name to go to name the named destination to go to

PdfAction

public PdfAction(String filename, int page)
Constructs a new PdfAction of Subtype GoToR.

Parameters: filename the file name to go to page the page destination to go to

PdfAction

public PdfAction(int named)
Implements name actions. The action can be FIRSTPAGE, LASTPAGE, NEXTPAGE, PREVPAGE and PRINTDIALOG.

Parameters: named the named action

PdfAction

public PdfAction(String application, String parameters, String operation, String defaultDir)
Launchs an application or a document.

Parameters: application the application to be launched or the document to be opened or printed. parameters (Windows-specific) A parameter string to be passed to the application. It can be null. operation (Windows-specific) the operation to perform: "open" - Open a document, "print" - Print a document. It can be null. defaultDir (Windows-specific) the default directory in standard DOS syntax. It can be null.

Method Detail

buildArray

static PdfArray buildArray(Object[] names)

createHide

static PdfAction createHide(PdfObject obj, boolean hide)
A Hide action hides or shows an object.

Parameters: obj object to hide or show hide true is hide, false is show

Returns: a Hide Action

createHide

public static PdfAction createHide(PdfAnnotation annot, boolean hide)
A Hide action hides or shows an annotation.

Parameters: annot hide

Returns: A Hide Action

createHide

public static PdfAction createHide(String name, boolean hide)
A Hide action hides or shows an annotation.

Parameters: name hide

Returns: A Hide Action

createHide

public static PdfAction createHide(Object[] names, boolean hide)
A Hide action hides or shows objects.

Parameters: names hide

Returns: A Hide Action

createImportData

public static PdfAction createImportData(String file)
Creates an Import field.

Parameters: file

Returns: A PdfAction

createLaunch

public static PdfAction createLaunch(String application, String parameters, String operation, String defaultDir)
Launchs an application or a document.

Parameters: application the application to be launched or the document to be opened or printed. parameters (Windows-specific) A parameter string to be passed to the application. It can be null. operation (Windows-specific) the operation to perform: "open" - Open a document, "print" - Print a document. It can be null. defaultDir (Windows-specific) the default directory in standard DOS syntax. It can be null.

Returns: a Launch action

createResetForm

public static PdfAction createResetForm(Object[] names, int flags)
Creates a resetform.

Parameters: names the objects to reset flags submit properties

Returns: A PdfAction

createSubmitForm

public static PdfAction createSubmitForm(String file, Object[] names, int flags)
Creates a submit form.

Parameters: file the URI to submit the form to names the objects to submit flags submit properties

Returns: A PdfAction

gotoEmbedded

public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, String dest, boolean isName, boolean newWindow)
Creates a GoToE action to an embedded file.

Parameters: filename the root document of the target (null if the target is in the same document) dest the named destination isName if true sets the destination as a name, if false sets it as a String

Returns: a GoToE action

gotoEmbedded

public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow)
Creates a GoToE action to an embedded file.

Parameters: filename the root document of the target (null if the target is in the same document) target a path to the target document of this action dest the destination inside the target document, can be of type PdfDestination, PdfName, or PdfString newWindow if true, the destination document should be opened in a new window

Returns: a GoToE action

gotoLocalPage

public static PdfAction gotoLocalPage(int page, PdfDestination dest, PdfWriter writer)
Creates a GoTo action to an internal page.

Parameters: page the page to go. First page is 1 dest the destination for the page writer the writer for this action

Returns: a GoTo action

gotoLocalPage

public static PdfAction gotoLocalPage(String dest, boolean isName)
Creates a GoTo action to a named destination.

Parameters: dest the named destination isName if true sets the destination as a name, if false sets it as a String

Returns: a GoTo action

gotoRemotePage

public static PdfAction gotoRemotePage(String filename, String dest, boolean isName, boolean newWindow)
Creates a GoToR action to a named destination.

Parameters: filename the file name to go to dest the destination name isName if true sets the destination as a name, if false sets it as a String newWindow open the document in a new window if true, if false the current document is replaced by the new document.

Returns: a GoToR action

javaScript

public static PdfAction javaScript(String code, PdfWriter writer, boolean unicode)
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.

Parameters: code the JavaScript code writer the writer for this action unicode select JavaScript unicode. Note that the internal Acrobat JavaScript engine does not support unicode, so this may or may not work for you

Returns: the JavaScript action

javaScript

public static PdfAction javaScript(String code, PdfWriter writer)
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.

Parameters: code the JavaScript code writer the writer for this action

Returns: the JavaScript action

next

public void next(PdfAction na)
Add a chained action.

Parameters: na the next action

rendition

public static PdfAction rendition(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref)
Creates a Rendition action

Parameters: file fs mimeType ref

Returns: a Media Clip action

Throws: IOException

setOCGstate

public static PdfAction setOCGstate(ArrayList state, boolean preserveRB)
A set-OCG-state action (PDF 1.5) sets the state of one or more optional content groups.

Parameters: state an array consisting of any number of sequences beginning with a PdfName 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:

preserveRB if true, indicates that radio-button state relationships between optional 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

Returns: the action