public class PdfAction extends PdfDictionary
PdfAction
defines an action that can be triggered from a PDF file.PdfDictionary
Modifier and Type | Field and Description |
---|---|
static int |
FIRSTPAGE
A named action to go to the first page.
|
static int |
LASTPAGE
A named action to go to the last page.
|
static int |
NEXTPAGE
A named action to go to the next page.
|
static int |
PREVPAGE
A named action to go to the previous page.
|
static int |
PRINTDIALOG
A named action to open a print dialog.
|
static int |
RESET_EXCLUDE
a possible submitvalue
|
static int |
SUBMIT_CANONICAL_FORMAT
a possible submitvalue
|
static int |
SUBMIT_COORDINATES
a possible submitvalue
|
static int |
SUBMIT_EMBED_FORM
a possible submitvalue
|
static int |
SUBMIT_EXCL_F_KEY
a possible submitvalue
|
static int |
SUBMIT_EXCL_NON_USER_ANNOTS
a possible submitvalue
|
static int |
SUBMIT_EXCLUDE
a possible submitvalue
|
static int |
SUBMIT_HTML_FORMAT
a possible submitvalue
|
static int |
SUBMIT_HTML_GET
a possible submitvalue
|
static int |
SUBMIT_INCLUDE_ANNOTATIONS
a possible submitvalue
|
static int |
SUBMIT_INCLUDE_APPEND_SAVES
a possible submitvalue
|
static int |
SUBMIT_INCLUDE_NO_VALUE_FIELDS
a possible submitvalue
|
static int |
SUBMIT_PDF
a possible submitvalue
|
static int |
SUBMIT_XFDF
a possible submitvalue
|
Constructor and Description |
---|
PdfAction()
Create an empty action.
|
PdfAction(int named)
Implements name actions.
|
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(String filename,
int page)
Constructs a new
PdfAction of Subtype GoToR. |
PdfAction(String filename,
String name)
Constructs a new
PdfAction of Subtype GoToR. |
PdfAction(String application,
String parameters,
String operation,
String defaultDir)
Launches an application or a document.
|
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. |
Modifier and Type | Method and Description |
---|---|
static PdfAction |
createHide(Object[] names,
boolean hide)
A Hide action hides or shows objects.
|
static PdfAction |
createHide(PdfAnnotation annot,
boolean hide)
A Hide action hides or shows an annotation.
|
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 |
next(PdfAction na)
Add a chained action.
|
static PdfAction |
rendition(String file,
PdfFileSpecification fs,
String mimeType,
PdfIndirectReference ref)
Creates a Rendition action
|
static 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.
|
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toPdf, toString
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
public static final int FIRSTPAGE
public static final int PREVPAGE
public static final int NEXTPAGE
public static final int LASTPAGE
public static final int PRINTDIALOG
public static final int SUBMIT_EXCLUDE
public static final int SUBMIT_INCLUDE_NO_VALUE_FIELDS
public static final int SUBMIT_HTML_FORMAT
public static final int SUBMIT_HTML_GET
public static final int SUBMIT_COORDINATES
public static final int SUBMIT_XFDF
public static final int SUBMIT_INCLUDE_APPEND_SAVES
public static final int SUBMIT_INCLUDE_ANNOTATIONS
public static final int SUBMIT_PDF
public static final int SUBMIT_CANONICAL_FORMAT
public static final int SUBMIT_EXCL_NON_USER_ANNOTS
public static final int SUBMIT_EXCL_F_KEY
public static final int SUBMIT_EMBED_FORM
public static final int RESET_EXCLUDE
public PdfAction()
public PdfAction(URL url)
PdfAction
of Subtype URI.url
- the Url to go topublic PdfAction(URL url, boolean isMap)
PdfAction
of Subtype URI that accepts the x and y coordinate of the position that was clicked.url
- isMap
- public PdfAction(String url)
PdfAction
of Subtype URI.url
- the url to go topublic PdfAction(String url, boolean isMap)
PdfAction
of Subtype URI that accepts the x and y coordinate of the position that was clicked.url
- isMap
- public PdfAction(String filename, String name)
PdfAction
of Subtype GoToR.filename
- the file name to go toname
- the named destination to go topublic PdfAction(String filename, int page)
PdfAction
of Subtype GoToR.filename
- the file name to go topage
- the page destination to go topublic PdfAction(int named)
named
- the named actionpublic PdfAction(String application, String parameters, String operation, String defaultDir)
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
.public static PdfAction createLaunch(String application, String parameters, String operation, String defaultDir)
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
.public static PdfAction rendition(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref) throws IOException
file
- fs
- mimeType
- ref
- IOException
public static PdfAction javaScript(String code, PdfWriter writer, boolean unicode)
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 youpublic static PdfAction javaScript(String code, PdfWriter writer)
code
- the JavaScript codewriter
- the writer for this actionpublic static PdfAction createHide(PdfAnnotation annot, boolean hide)
annot
- hide
- public static PdfAction createHide(String name, boolean hide)
name
- hide
- public static PdfAction createHide(Object[] names, boolean hide)
names
- hide
- public static PdfAction createSubmitForm(String file, Object[] names, int flags)
file
- the URI to submit the form tonames
- the objects to submitflags
- submit propertiespublic static PdfAction createResetForm(Object[] names, int flags)
names
- the objects to resetflags
- submit propertiespublic static PdfAction createImportData(String file)
file
- public void next(PdfAction na)
na
- the next actionpublic static PdfAction gotoLocalPage(int page, PdfDestination dest, PdfWriter writer)
page
- the page to go. First page is 1dest
- the destination for the pagewriter
- the writer for this actionpublic static PdfAction gotoLocalPage(String dest, boolean isName)
dest
- the named destinationisName
- if true sets the destination as a name, if false sets it as a Stringpublic static PdfAction gotoRemotePage(String filename, String dest, boolean isName, boolean newWindow)
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 if true
, if false the current document is replaced by the new document.public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, String dest, boolean isName, boolean newWindow)
filename
- the root document of the target (null if the target is in the same document)dest
- the named destinationisName
- if true sets the destination as a name, if false sets it as a Stringpublic static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow)
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 windowpublic static PdfAction setOCGstate(List<Object> state, boolean preserveRB)
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
.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.false
, radio-button state relationships, if any, are ignoredCopyright © 2020. All rights reserved.