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 intA named action to go to the first page.private static final intA named action to go to the last page.private static final intA named action to go to the next page.private static final intA named action to go to the previous page.private static final intA named action to open a print dialog.Fields inherited from class PdfDictionary
CATALOG, hashMap, OUTLINES, PAGEFields inherited from class 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 newPdfActionof Subtype GoTo.Constructs a newPdfActionof Subtype URI.privateConstruct a newPdfActionof Subtype URI that accepts the x and y coordinate of the position that was clicked.Constructs a newPdfActionof Subtype GoToR.Constructs a newPdfActionof Subtype GoToR.Launches an application or a document.Constructs a newPdfActionof Subtype URI. -
Method Summary
Modifier and TypeMethodDescriptionprivate static PdfArraybuildArray(Object[] names) private static PdfActioncreateHide(PdfObject obj, boolean hide) A Hide action hides or shows an object.private static PdfActiongotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow) Creates a GoToE action to an embedded file.(package private) static PdfActionjavaScript(String code, PdfWriter writer, boolean unicode) Creates a JavaScript action.(package private) static PdfActionrendition(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref) Creates a Rendition actionMethods inherited from class PdfDictionary
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, remove, size, toPdf, toStringMethods inherited from class 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 newPdfActionof Subtype URI.- Parameters:
url- the Url to go to
-
PdfAction
Constructs a newPdfActionof Subtype URI.- Parameters:
url- the url to go to
-
PdfAction
Construct a newPdfActionof Subtype URI that accepts the x and y coordinate of the position that was clicked.- Parameters:
url-isMap-
-
PdfAction
PdfAction(PdfIndirectReference destination) Constructs a newPdfActionof Subtype GoTo.- Parameters:
destination- the destination to go to
-
PdfAction
-
PdfAction
Constructs a newPdfActionof 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
-
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
-