Package com.aowagie.text.pdf
Class PdfAction
java.lang.Object
com.aowagie.text.pdf.PdfObject
com.aowagie.text.pdf.PdfDictionary
com.aowagie.text.pdf.PdfAction
A
PdfAction
defines an action that can be triggered from a PDF file.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
A named action to go to the first page.private static final int
A named action to go to the last page.private static final int
A named action to go to the next page.private static final int
A named action to go to the previous page.private static final int
A named action to open a print dialog.Fields inherited from class com.aowagie.text.pdf.PdfDictionary
CATALOG, hashMap, OUTLINES, PAGE
Fields inherited from class com.aowagie.text.pdf.PdfObject
ARRAY, BOOLEAN, bytes, DICTIONARY, INDIRECT, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE, type
-
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate an empty action.PdfAction
(int named) Implements name actions.(package private)
PdfAction
(PdfIndirectReference destination) Constructs a newPdfAction
of Subtype GoTo.Constructs a newPdfAction
of Subtype URI.private
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. -
Method Summary
Modifier and TypeMethodDescriptionprivate static PdfArray
buildArray
(Object[] names) private static PdfAction
createHide
(PdfObject obj, boolean hide) A Hide action hides or shows an object.private static PdfAction
gotoEmbedded
(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow) Creates a GoToE action to an embedded file.(package private) static PdfAction
javaScript
(String code, PdfWriter writer, boolean unicode) Creates a JavaScript action.(package private) static PdfAction
rendition
(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref) Creates a Rendition actionMethods inherited from class com.aowagie.text.pdf.PdfDictionary
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, remove, size, toPdf, toString
Methods inherited from class com.aowagie.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, setContent, setIndRef, type
-
Field Details
-
FIRSTPAGE
private static final int FIRSTPAGEA named action to go to the first page.- See Also:
-
PREVPAGE
private static final int PREVPAGEA named action to go to the previous page.- See Also:
-
NEXTPAGE
private static final int NEXTPAGEA named action to go to the next page.- See Also:
-
LASTPAGE
private static final int LASTPAGEA named action to go to the last page.- See Also:
-
PRINTDIALOG
private static final int PRINTDIALOGA named action to open a print dialog.- 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
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
-isMap
-
-
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
-
rendition
static PdfAction rendition(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref) throws IOException Creates a Rendition action- Parameters:
file
-fs
-mimeType
-ref
-- Returns:
- a Media Clip action
- Throws:
IOException
-
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
-
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
-
buildArray
-
gotoEmbedded
private 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
-