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
-
public class PdfAction extends PdfDictionary
APdfActiondefines an action that can be triggered from a PDF file.- See Also:
PdfDictionary
-
-
Field Summary
Fields Modifier and Type Field Description private static intFIRSTPAGEA named action to go to the first page.private static intLASTPAGEA named action to go to the last page.private static intNEXTPAGEA named action to go to the next page.private static intPREVPAGEA named action to go to the previous page.private static intPRINTDIALOGA 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
Constructors Modifier Constructor Description PdfAction()Create an empty action.PdfAction(int named)Implements name actions.(package private)PdfAction(PdfIndirectReference destination)Constructs a newPdfActionof Subtype GoTo.PdfAction(java.lang.String url)Constructs a newPdfActionof Subtype URI.privatePdfAction(java.lang.String url, boolean isMap)Construct a newPdfActionof Subtype URI that accepts the x and y coordinate of the position that was clicked.PdfAction(java.lang.String filename, int page)Constructs a newPdfActionof Subtype GoToR.PdfAction(java.lang.String filename, java.lang.String name)Constructs a newPdfActionof Subtype GoToR.PdfAction(java.lang.String application, java.lang.String parameters, java.lang.String operation, java.lang.String defaultDir)Launches an application or a document.PdfAction(java.net.URL url)Constructs a newPdfActionof Subtype URI.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static PdfArraybuildArray(java.lang.Object[] names)private static PdfActioncreateHide(PdfObject obj, boolean hide)A Hide action hides or shows an object.private static PdfActiongotoEmbedded(java.lang.String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow)Creates a GoToE action to an embedded file.(package private) static PdfActionjavaScript(java.lang.String code, PdfWriter writer, boolean unicode)Creates a JavaScript action.(package private) static PdfActionrendition(java.lang.String file, PdfFileSpecification fs, java.lang.String mimeType, PdfIndirectReference ref)Creates a Rendition action-
Methods 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 Detail
-
FIRSTPAGE
private static final int FIRSTPAGE
A named action to go to the first page.- See Also:
- Constant Field Values
-
PREVPAGE
private static final int PREVPAGE
A named action to go to the previous page.- See Also:
- Constant Field Values
-
NEXTPAGE
private static final int NEXTPAGE
A named action to go to the next page.- See Also:
- Constant Field Values
-
LASTPAGE
private static final int LASTPAGE
A named action to go to the last page.- See Also:
- Constant Field Values
-
PRINTDIALOG
private static final int PRINTDIALOG
A named action to open a print dialog.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PdfAction
public PdfAction()
Create an empty action.
-
PdfAction
public PdfAction(java.net.URL url)
Constructs a newPdfActionof Subtype URI.- Parameters:
url- the Url to go to
-
PdfAction
public PdfAction(java.lang.String url)
Constructs a newPdfActionof Subtype URI.- Parameters:
url- the url to go to
-
PdfAction
private PdfAction(java.lang.String url, boolean isMap)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
public PdfAction(java.lang.String filename, java.lang.String name)Constructs a newPdfActionof Subtype GoToR.- Parameters:
filename- the file name to go toname- the named destination to go to
-
PdfAction
public PdfAction(java.lang.String filename, int page)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
public PdfAction(java.lang.String application, java.lang.String parameters, java.lang.String operation, java.lang.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.
-
-
Method Detail
-
rendition
static PdfAction rendition(java.lang.String file, PdfFileSpecification fs, java.lang.String mimeType, PdfIndirectReference ref) throws java.io.IOException
Creates a Rendition action- Parameters:
file-fs-mimeType-ref-- Returns:
- a Media Clip action
- Throws:
java.io.IOException
-
javaScript
static PdfAction javaScript(java.lang.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 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
private static PdfAction createHide(PdfObject obj, boolean hide)
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
private static PdfArray buildArray(java.lang.Object[] names)
-
gotoEmbedded
private static PdfAction gotoEmbedded(java.lang.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
-
-