public class Widget extends Annot
Widget
represents the PDF widget annotation.
It offers specific properties get/set methods for widget annotation.
Before call all methods in this class,
please note to call
at first.PDFPage.loadAnnots()
Modifier and Type | Class and Description |
---|---|
static class |
Widget.AnnotIconFit
AnnotIconFit is an inner class defined for the annotation icon fit information. |
Annot.Border, Annot.QuadpointsF
BORDERSTYLE_BEVELED, BORDERSTYLE_CLOUDY, BORDERSTYLE_DASHED, BORDERSTYLE_INSET, BORDERSTYLE_SOLID, BORDERSTYLE_UNDERLINE, FLAG_HIDDEN, FLAG_INVISIBLE, FLAG_LOCKED, FLAG_LOCKEDCONTENTS, FLAG_NOROTATE, FLAG_NOVIEW, FLAG_NOZOOM, FLAG_PRINT, FLAG_READONLY, FLAG_TOGGLENOVIEW, HIGHLIGHTINGMODE_INVERT, HIGHLIGHTINGMODE_NONE, HIGHLIGHTINGMODE_OUTLINE, HIGHLIGHTINGMODE_PUSH, HIGHLIGHTINGMODE_TOGGLE, MKENTRY_BACKGROUNDCOLOR, MKENTRY_BORDERCOLOR, MKENTRY_DOWNCAPTION, MKENTRY_DOWNICON, MKENTRY_ICONFIT, MKENTRY_NORMALCAPTION, MKENTRY_NORMALICON, MKENTRY_ROLLOVERCAPTION, MKENTRY_ROLLOVERICON, MKENTRY_ROTATION, MKENTRY_TEXTPOSITION, TRIGGER_ANNOT_CE, TRIGGER_ANNOT_CX, TRIGGER_ANNOT_FL, TRIGGER_ANNOT_FO, TRIGGER_ANNOT_MD, TRIGGER_ANNOT_MU, TRIGGER_ANNOT_PC, TRIGGER_ANNOT_PI, TRIGGER_ANNOT_PO, TRIGGER_ANNOT_PV, TYPE_3D, TYPE_CARET, TYPE_CIRCLE, TYPE_FILEATTACHMENT, TYPE_FREETEXT, TYPE_HIGHLIGHT, TYPE_INK, TYPE_LINE, TYPE_LINK, TYPE_MOVIE, TYPE_POLYGON, TYPE_POLYLINE, TYPE_POPUP, TYPE_PRINTERMARK, TYPE_PSI, TYPE_SCREEN, TYPE_SOUND, TYPE_SQUARE, TYPE_SQUIGGLY, TYPE_STAMP, TYPE_STRIKEOUT, TYPE_TEXT, TYPE_TRAPNET, TYPE_UNDERLINE, TYPE_WATERMARK, TYPE_WIDGET
Modifier and Type | Method and Description |
---|---|
int |
countActions(int trigger)
Count actions associated with current widget annotation.
|
PDFAction |
getAction(int trigger,
int index)
Get action data of specific index associated with current annotation.
|
int |
getHighlightingMode()
Get highlighting mode of current PDF widget annotation.
|
Widget.AnnotIconFit |
getIconFit()
Get icon fit of current widget annotation.
|
java.lang.String |
getMKCaption(int mkEntry)
Get caption of a specific type in MK dictionary.
|
long |
getMKColor(int mkEntry)
Get color of a specific type in MK dictionary.
|
android.graphics.Bitmap |
getMKIconBitmap(int mkEntry)
Get icon bitmap of specific icon type in MK dictionary.
|
int |
getMKRotation()
Get rotation (the number of degrees) in MK dictionary.
|
boolean |
hasMKEntry(int mkEntry)
Checks if specific entry is in MK dictionary.
|
void |
insertAction(int trigger,
int index,
PDFAction action)
Insert action data of specified index associated with current widget
annotation.
|
boolean |
removeAction(int trigger,
int index)
Remove an action of specified index associated with current widget annotation.
|
boolean |
removeAllActions(int trigger)
Remove all the actions associated with current widget annotation.
|
boolean |
removeMKEntry(int mkEntry)
Remove a specified entry in MK dictionary.
|
void |
resetAppearance()
Reset(regenerate) appearance of current widget annotation.
|
boolean |
setAction(int trigger,
int index,
PDFAction action)
Set action data of specified index associated with current widget annotation.
|
void |
setHighLightingMode(int hlMode)
Set highlighting mode of current PDF widget annotation.
|
void |
setIconFit(Widget.AnnotIconFit iconfit)
Set icon fit of current widget annotation.
|
void |
setMKCaption(int mkEntry,
java.lang.String caption)
Set caption of a specific type in MK dictionary.
|
void |
setMKColor(int mkEntry,
long color)
Set color of specific type in MK dictionary.
|
void |
setMKIconImage(int mkEntry,
Image image)
Set an image to a specific icon type in MK dictionary.
|
void |
setMKRotation(int degree)
Set rotation in MK dictionary.
|
getBorder, getBorderColor, getContents, getDeviceRect, getFlags, getHandle, getIndex, getModifiedDateTime, getName, getRect, getType, isMarkup, move, setBorder, setBorderColor, setContents, setFlags, setIconProvider, setModifiedDateTime, setName
public int getHighlightingMode() throws PDFException
integer
value of highlighting mode property. Please refer to
definitions
HIGHLIGHTINGMODE_XXX
.
If not found, it will return -1.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setHighLightingMode(int hlMode) throws PDFException
hlMode
- Highlighting mode to be set to the annotation. It should be
one of the following:
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Widget.AnnotIconFit getIconFit() throws PDFException
The icon fit property belongs to MK dictionary. It specifies how to display widget annotation's icon within the annotation rectangle. If present, icon fit property applies to all of annotation's icons (normal, rollover, and alternate).
AnnotIconFit
object that receives value of icon
fit property.null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Widget.AnnotIconFit
public void setIconFit(Widget.AnnotIconFit iconfit) throws PDFException
The icon fit property belongs to MK dictionary. It specifies how to display widget annotation's icon within the annotation rectangle. If present, icon fit property applies to all of annotation's icons (normal, rollover, and alternate).
iconfit
- An AnnotIconFit
object that specifies new value
of icon fit property.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Widget.AnnotIconFit
public boolean hasMKEntry(int mkEntry) throws PDFException
MK entry can be used to provide an appearance characteristics dictionary containing additional information for constructing the annotation's appearance stream.
mkEntry
- An integer
value used to specify entry in MK dictionary.
Please refer to definitions
MKENTRY_XXX
and it should be one of them.boolean
value which indicates if specific entry is
in MK dictionary.false
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public boolean removeMKEntry(int mkEntry) throws PDFException
mkEntry
- An integer
value that specified an entry in MK dictionary,
which will be removed from MK dictionary. Please refers to
MKENTRY_XXX
and this should be one of them.true
if removed successfully, else return
false
for not found the specified MK dictionary.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public int getMKRotation() throws PDFException
integer
value that specifies the value of rotation entry in MK
dictionary.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setMKRotation(int degree) throws PDFException
degree
- An integer
that specifies the new value of rotation entry. The
value must be a multiple of 90.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public long getMKColor(int mkEntry) throws PDFException
mkEntry
- An integer
value to specify type of color entry in MK
dictionary. It should be one of the following:long
value that specifies the value of color of specific
type. Format: 0xAARRGGBB, and alpha component is ignored. PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setMKColor(int mkEntry, long color) throws PDFException
mkEntry
- An integer
value to specify the type of color entry in MK
dictionary. It should be one of the following:color
- A long
value that specifies the value of new color in
specific type. Format: 0xAARRGGBB, and alpha value is ignored.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public java.lang.String getMKCaption(int mkEntry) throws PDFException
mkEntry
- An integer
value to specify type of caption entry in MK
dictionary. It should be one of the following:String
object that receives caption of specific
type in MK dictionary.null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setMKCaption(int mkEntry, java.lang.String caption) throws PDFException
mkEntry
- An integer
value to specify the type of icon entry in MK
dictionary. It should be one of the following:caption
- A String
object that specifies the new caption in
a specific type. It can be empty.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public android.graphics.Bitmap getMKIconBitmap(int mkEntry) throws PDFException
Actually, icon of widget annotation is defined by a FormXObject. Foxit PDF SDK only supports to get icon bitmap if this FormXObject's appearance is an image object.
mkEntry
- An integer
value to specify type of icon entry in MK
dictionary. It should be one of the following:Bitmap
object that receives the icon bitmap of
specific icon type in MK dictionary.null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setMKIconImage(int mkEntry, Image image) throws PDFException
mkEntry
- An integer
value to specify type of icon entry in MK
dictionary. It should be one of the following:image
- An Image
object which specifies the new icon
image. And before use it, application should also call
function Image.loadFrame(int)
. To make sure which
frame of the image will be used to set MK icon.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Image
public int countActions(int trigger) throws PDFException
trigger
- The trigger of action. Please refer to
TRIGGER_ANNOT_XXX
and this should be one of them.integer
value that specified the count of actions.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public PDFAction getAction(int trigger, int index) throws PDFException
trigger
- The trigger of action. Please refer to
TRIGGER_ANNOT_XXX
and this should be one of them.index
- The index of actions. Range: 0 to (actioncount-1).
actioncount
is returned by function
countActions(int)
with the same
parameter trigger
.PDFAction
object that receives the specific
action.null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAction
public boolean setAction(int trigger, int index, PDFAction action) throws PDFException
trigger
- The trigger of action. Please refer to
TRIGGER_ANNOT_XXX
and this should be one of them.index
- Index of the action which will be replaced by new action.
Range: 0 to (actioncount
-1).
actioncount
is returned by function
countActions(int)
.action
- A PDFAction
object that specific the new action
which is to be set to annotation.true
if set successfully, else return
false
for the parameter index
is out of
range.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAction
public void insertAction(int trigger, int index, PDFAction action) throws PDFException
trigger
- The trigger of action. Please refer to
TRIGGER_ANNOT_XXX
and this should be one of them.index
- An integer value that specifies the position to insert new
action. Range: 0 to (actioncount
-1).
actioncount
is returned by function
countActions(int)
. If it's out of
the range, parameter action
will be inserted to
the last.action
- A PDFAction
object that specific the new action
which is to be inserted to annotation.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAction
public boolean removeAction(int trigger, int index) throws PDFException
trigger
- The trigger of action. Please refer to
TRIGGER_ANNOT_XXX
and this should be one of them.index
- An integer value that specifies action to be removed. Range: 0
to (actioncount
-1). actioncount
is
returned by function
countActions(int)
.true
if removed successfully, else return
false
for the specified index
is out of
range.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public boolean removeAllActions(int trigger) throws PDFException
trigger
- The trigger of action. Please refer to
TRIGGER_ANNOT_XXX
and this should be one of them.true
if removed successfully, else return
false
for not found the specified actions.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public void resetAppearance() throws PDFException
Foxit PDF SDK assumes that a widget annotation would represent a form control of form field.
So in order to reset appearance of current widget annotation, function PDFDocument.loadForm()
should be called first,
even before function PDFPage.loadAnnots()
is called.
If function PDFDocument.loadForm()
hasn't been called yet, this function will throw PDFException.ERRCODE_UNKNOWNSTATE
.
For a widget annotation which is associated with a signature field, please use function Signature.resetAppearance()
instead.
PDFException
- PDFException.ERRCODE_UNSUPPORTED
means current widget annotation is associated with a signature field.
Please use function Signature.resetAppearance()
instead.
PDFException.ERRCODE_XXX
.PDFException
,
PDFPage
,
PDFDocument
,
Signature