Package com.lowagie.text.pdf
Class PdfAction
java.lang.Object
com.lowagie.text.pdf.PdfObject
com.lowagie.text.pdf.PdfDictionary
com.lowagie.text.pdf.PdfAction
A
PdfAction
defines an action that can be triggered from a PDF file.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
A named action to go to the first page.static final int
A named action to go to the last page.static final int
A named action to go to the next page.static final int
A named action to go to the previous page.static final int
A named action to open a print dialog.static final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvaluestatic final int
a possible submitvalue -
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty action.PdfAction
(int named) Implements name actions.PdfAction
(PdfIndirectReference destination) Constructs a newPdfAction
of Subtype GoTo.Constructs a newPdfAction
of Subtype URI.Construct a newPdfAction
of Subtype URI that accepts the x and y coordinate of the position that was clicked.Constructs a newPdfAction
of Subtype GoToR.Constructs a newPdfAction
of Subtype GoToR.Launches an application or a document.Constructs a newPdfAction
of Subtype URI.Construct a newPdfAction
of Subtype URI that accepts the x and y coordinate of the position that was clicked. -
Method Summary
Modifier and TypeMethodDescription(package private) static PdfArray
buildArray
(Object[] names) static PdfAction
createHide
(PdfAnnotation annot, boolean hide) A Hide action hides or shows an annotation.(package private) static PdfAction
createHide
(PdfObject obj, boolean hide) A Hide action hides or shows an object.static PdfAction
createHide
(Object[] names, boolean hide) A Hide action hides or shows objects.static PdfAction
createHide
(String name, boolean hide) A Hide action hides or shows an annotation.static PdfAction
createImportData
(String file) Creates an Import field.static PdfAction
createLaunch
(String application, String parameters, String operation, String defaultDir) Launches an application or a document.static PdfAction
createResetForm
(Object[] names, int flags) Creates a resetform.static PdfAction
createSubmitForm
(String file, Object[] names, int flags) Creates a submit form.static PdfAction
gotoEmbedded
(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow) Creates a GoToE action to an embedded file.static PdfAction
gotoEmbedded
(String filename, PdfTargetDictionary target, String dest, boolean isName, boolean newWindow) Creates a GoToE action to an embedded file.static PdfAction
gotoLocalPage
(int page, PdfDestination dest, PdfWriter writer) Creates a GoTo action to an internal page.static PdfAction
gotoLocalPage
(String dest, boolean isName) Creates a GoTo action to a named destination.static PdfAction
gotoRemotePage
(String filename, String dest, boolean isName, boolean newWindow) Creates a GoToR action to a named destination.static PdfAction
javaScript
(String code, PdfWriter writer) Creates a JavaScript action.static PdfAction
javaScript
(String code, PdfWriter writer, boolean unicode) Creates a JavaScript action.void
Add a chained action.static PdfAction
rendition
(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref) Creates a Rendition actionstatic PdfAction
setOCGstate
(List<Object> state, boolean preserveRB) A set-OCG-state action (PDF 1.5) sets the state of one or more optional content groups.Methods inherited from class com.lowagie.text.pdf.PdfDictionary
clear, contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, getKeysAndValues, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toPdf, toString
Methods inherited from class com.lowagie.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
Field Details
-
FIRSTPAGE
public static final int FIRSTPAGEA named action to go to the first page.- See Also:
-
PREVPAGE
public static final int PREVPAGEA named action to go to the previous page.- See Also:
-
NEXTPAGE
public static final int NEXTPAGEA named action to go to the next page.- See Also:
-
LASTPAGE
public static final int LASTPAGEA named action to go to the last page.- See Also:
-
PRINTDIALOG
public static final int PRINTDIALOGA named action to open a print dialog.- See Also:
-
SUBMIT_EXCLUDE
public static final int SUBMIT_EXCLUDEa possible submitvalue- See Also:
-
SUBMIT_INCLUDE_NO_VALUE_FIELDS
public static final int SUBMIT_INCLUDE_NO_VALUE_FIELDSa possible submitvalue- See Also:
-
SUBMIT_HTML_FORMAT
public static final int SUBMIT_HTML_FORMATa possible submitvalue- See Also:
-
SUBMIT_HTML_GET
public static final int SUBMIT_HTML_GETa possible submitvalue- See Also:
-
SUBMIT_COORDINATES
public static final int SUBMIT_COORDINATESa possible submitvalue- See Also:
-
SUBMIT_XFDF
public static final int SUBMIT_XFDFa possible submitvalue- See Also:
-
SUBMIT_INCLUDE_APPEND_SAVES
public static final int SUBMIT_INCLUDE_APPEND_SAVESa possible submitvalue- See Also:
-
SUBMIT_INCLUDE_ANNOTATIONS
public static final int SUBMIT_INCLUDE_ANNOTATIONSa possible submitvalue- See Also:
-
SUBMIT_PDF
public static final int SUBMIT_PDFa possible submitvalue- See Also:
-
SUBMIT_CANONICAL_FORMAT
public static final int SUBMIT_CANONICAL_FORMATa possible submitvalue- See Also:
-
SUBMIT_EXCL_NON_USER_ANNOTS
public static final int SUBMIT_EXCL_NON_USER_ANNOTSa possible submitvalue- See Also:
-
SUBMIT_EXCL_F_KEY
public static final int SUBMIT_EXCL_F_KEYa possible submitvalue- See Also:
-
SUBMIT_EMBED_FORM
public static final int SUBMIT_EMBED_FORMa possible submitvalue- See Also:
-
RESET_EXCLUDE
public static final int RESET_EXCLUDEa possible submitvalue- See Also:
-
-
Constructor Details
-
PdfAction
public PdfAction()Create an empty action. -
PdfAction
Constructs a newPdfAction
of Subtype URI.- Parameters:
url
- the Url to go to
-
PdfAction
Construct a newPdfAction
of Subtype URI that accepts the x and y coordinate of the position that was clicked.- Parameters:
url
- the URLisMap
- true if it is a map, false otherwise
-
PdfAction
Constructs a newPdfAction
of Subtype URI.- Parameters:
url
- the url to go to
-
PdfAction
Construct a newPdfAction
of Subtype URI that accepts the x and y coordinate of the position that was clicked.- Parameters:
url
- the URLisMap
- true if it is a map, false otherwise
-
PdfAction
PdfAction(PdfIndirectReference destination) Constructs a newPdfAction
of Subtype GoTo.- Parameters:
destination
- the destination to go to
-
PdfAction
Constructs a newPdfAction
of Subtype GoToR.- Parameters:
filename
- the file name to go toname
- the named destination to go to
-
PdfAction
Constructs a newPdfAction
of Subtype GoToR.- Parameters:
filename
- the file name to go topage
- 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
Launches 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 benull
.operation
- (Windows-specific) the operation to perform: "open" - Open a document, "print" - Print a document. It can benull
.defaultDir
- (Windows-specific) the default directory in standard DOS syntax. It can benull
.
-
-
Method Details
-
createLaunch
public static PdfAction createLaunch(String application, String parameters, String operation, String defaultDir) Launches 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 benull
.operation
- (Windows-specific) the operation to perform: "open" - Open a document, "print" - Print a document. It can benull
.defaultDir
- (Windows-specific) the default directory in standard DOS syntax. It can benull
.- Returns:
- a Launch action
-
rendition
public static PdfAction rendition(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref) throws IOException Creates a Rendition action- Parameters:
file
- the name of the filefs
- the PdfSpecificationmimeType
- the mime typeref
- the PdfIndirectReference- Returns:
- a Media Clip action
- Throws:
IOException
- thrown when an I/O operation fails
-
javaScript
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 codewriter
- the writer for this actionunicode
- 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
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 codewriter
- the writer for this action- Returns:
- the JavaScript action
-
createHide
A Hide action hides or shows an object.- Parameters:
obj
- object to hide or showhide
- true is hide, false is show- Returns:
- a Hide Action
-
createHide
A Hide action hides or shows an annotation.- Parameters:
annot
- the annotation to hide or showhide
- true is hide, false is show- Returns:
- A Hide Action
-
createHide
A Hide action hides or shows an annotation.- Parameters:
name
- the name of the object to hide or showhide
- true is hide, false is show- Returns:
- A Hide Action
-
buildArray
-
createHide
A Hide action hides or shows objects.- Parameters:
names
- Object array containing the Objects to hide or showhide
- true is hide, false is show- Returns:
- A Hide Action
-
createSubmitForm
Creates a submit form.- Parameters:
file
- the URI to submit the form tonames
- the objects to submitflags
- submit properties- Returns:
- A PdfAction
-
createResetForm
Creates a resetform.- Parameters:
names
- the objects to resetflags
- submit properties- Returns:
- A PdfAction
-
createImportData
Creates an Import field.- Parameters:
file
- the name of the file- Returns:
- A PdfAction
-
gotoLocalPage
Creates a GoTo action to an internal page.- Parameters:
page
- the page to go. First page is 1dest
- the destination for the pagewriter
- the writer for this action- Returns:
- a GoTo action
-
gotoLocalPage
Creates a GoTo action to a named destination.- Parameters:
dest
- the named destinationisName
- 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 todest
- the destination nameisName
- if true sets the destination as a name, if false sets it as a StringnewWindow
- open the document in a new window iftrue
, if false the current document is replaced by the new document.- Returns:
- a GoToR action
-
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)target
- a path to the target document of this actiondest
- the named destinationisName
- if true sets the destination as a name, if false sets it as a StringnewWindow
- if true, the doc should be opened in a new window- 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 actiondest
- the destination inside the target document, can be of type PdfDestination, PdfName, or PdfStringnewWindow
- if true, the destination document should be opened in a new window- Returns:
- a GoToE action
-
setOCGstate
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 aPdfName
orString
(ON, OFF, or Toggle) followed by one or more optional content group dictionariesPdfLayer
or aPdfIndirectReference
to aPdfLayer
.
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
preserveRB
- iftrue
, 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 thestate
array are applied. That is, if a group is set to ON (either by ON or Toggle) during processing of thestate
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.
Iffalse
, radio-button state relationships, if any, are ignored- Returns:
- the action
-
next
Add a chained action.- Parameters:
na
- the next action
-