public class PDFPage
extends java.lang.Object
PDFPage
represents a PDF page.
The PDFPage
class defines methods to do some operations on PDF page.
There are two PDF page parsing modes: one is normal, and the other one is for text only. Non-text objects in page will be omitted. And two PDF pages render modes: one is normal, and the other one is for quick draw page content.
Currently Foxit PDF SDK supports two modes to calculate page margin:
one is analyzing bounding box of all page contents, and the other one is
detecting paths which take background or images to calculate margin.
PDF defines a set of page areas.
User can select a proper page area according to application intentions.
It can be constructed by the following ways.
Example:
PDFDocument document = PDFDocument.open(file,password); PDFPage pdfPage = document.getPage(index); PDFPage pdfPage = document.createPage(index);
PDFDocument
Modifier and Type | Field and Description |
---|---|
static int |
BOX_ARTBOX
Art Box for page area.
|
static int |
BOX_BLEEDBOX
Bleed Box for page area.
|
static int |
BOX_CROPBOX
Crop Box for page area.
|
static int |
BOX_MEDIABOX
Media Box for page area.
|
static int |
BOX_TRIMBOX
Trim Box for page area.
|
static int |
FLATTENFLAG_DISPLAY
Flatten contents for displaying.
|
static int |
FLATTENFLAG_NOANNOT
Flatten contents without annotations except widget annotation.
|
static int |
FLATTENFLAG_NOFORMCONTROL
Flatten contents without form controls.
|
static int |
FLATTENFLAG_PRINT
Flatten contents for printing, ignoring text, file attachment and sound annotations.
|
static int |
MARGIN_CONTENTSBBOX
Calculate margin according to bounding box of all contents.
|
static int |
MARGIN_DETECTION
Calculate margin by detecting paths or images.
|
static int |
PARSEFLAG_NORMAL
PDF page parsing flag for normal mode.
|
static int |
PARSEFLAG_TEXTONLY
PDF page parsing flag for text-only mode.
|
static int |
RENDERFLAG_NORMAL
PDF page render flag for normal mode.
|
static int |
RENDERFLAG_QUICKDRAW
PDF page parsing flag for quick draw mode.
|
static int |
ROTATION_0
No rotation.
|
static int |
ROTATION_180
Rotate 180 degrees in clockwise direction.
|
static int |
ROTATION_270
Rotate 270 degrees in clockwise direction.
|
static int |
ROTATION_90
Rotate 90 degrees in clockwise direction.
|
static int |
TRIGGER_PAGE_PC
An action to be performed when the page is closed.
|
static int |
TRIGGER_PAGE_PO
An action to be performed when the page is opened.
|
Modifier and Type | Method and Description |
---|---|
Annot |
addAnnot(android.graphics.RectF rectf,
java.lang.String annotType,
java.lang.String filter,
int index)
Add an annotation with a specific index, by specific filter.
|
Signature |
addSignature(android.graphics.RectF rect)
Add an unsigned signature field without appearance to a specific
position in current PDF page.
|
android.graphics.RectF |
calcContentBBox(int mode)
Calculate content box rectangle in PDF page.
|
int |
countActions(int trigger)
Count trigger actions of a page.
|
int |
countAnnots(java.lang.String filter)
Get count of annotations, by specific filter.
|
int |
countWatermarks()
Get count of watermarks in current page, not including the SDK trial watermark.
|
Annot |
deserializeAnnot(Archive archive)
Deserialize the annotation.
|
boolean |
doJavaScriptAction(int trigger)
Perform the page javascript which is specified by the trigger.
|
void |
flatten(int flags)
Flatten a PDF page, and annotations or form fields will be made to be a
part of the page contents.
|
PDFAction |
getAction(int trigger,
int index)
Get a trigger action of a page.
|
Annot[] |
getAllAnnotsByTabOrder(java.lang.String filter)
Get annotations with specific filter by tab order,used for some android devices
which have physical keyboards.
|
Annot |
getAnnot(java.lang.String filter,
int index)
Get annotation with a specified index, by specific filter.
|
Annot |
getAnnotAtDevicePos(java.lang.String filter,
android.graphics.Matrix matrix,
android.graphics.Point pt,
float tolerance)
Get annotation at a specific position in device (in pixel), by specific
filter.
|
Annot |
getAnnotAtPos(java.lang.String filter,
android.graphics.PointF pt,
float tolerance)
Get annotation at a specific position in PDF page, by specific filter.
|
android.graphics.RectF |
getBox(int boxType)
Get page box which is a value of rectangle type.
|
android.graphics.Matrix |
getDisplayMatrix(int x,
int y,
int width,
int height,
int rotation)
Get page transformation matrix.
|
PDFDocument |
getDocument()
Retrieve the PDF document object related to current page.
|
long |
getHandle()
Get the PDF page handle.
|
int |
getIndex()
Get the page index.
|
PageObjects |
getPageObjects()
Get page objects in a PDF page.
|
int |
getRotation()
Get page rotation.
|
SizeF |
getSize()
Get page size.
|
void |
insertAction(int trigger,
int index,
PDFAction action)
Insert a page trigger action.
|
boolean |
isParsed()
Check whether the page has been parsed or not.
|
void |
loadAnnots()
Load annotations from a PDF page.
|
boolean |
removeAction(int trigger,
int index)
Remove a page trigger action.
|
boolean |
removeAllActions(int trigger)
Remove all trigger actions of a page.
|
void |
removeAnnot(Annot annot)
Remove an annotation from page.
|
boolean |
removeWatermark(int index)
Remove a watermark by index from current page,
not including the SDK trial watermark.
|
void |
removeWatermarks()
Remove all watermarks in the current page.
|
void |
serializeAnnot(Archive archive,
Annot annot)
Serialize a annotation.
|
boolean |
setAction(int trigger,
int index,
PDFAction action)
Set a page trigger action.
|
void |
setBox(int boxType,
android.graphics.RectF pageBox)
Set page area which is a rectangle type of value.
|
void |
setIndex(int index)
Change page index of a page.
|
void |
setRotation(int rotation)
Set page rotation.
|
void |
setSize(float width,
float height)
Set page size.
|
Progress |
startParse(int flag)
Start parsing a PDF page.
|
Progress |
startRender(RenderContext context,
Renderer render,
int flag)
Start rendering a PDF page in a renderer with a PDF rendering context.
|
Progress |
startRenderAnnots(RenderContext context,
Renderer render,
Annot[] annots)
Render annotations on render context.
|
Progress |
startRenderFormControls(RenderContext context,
Renderer render,
PDFFormControl[] formControls)
Start rendering a PDF form control in a renderer with a PDF rendering
context.
|
Progress |
startRenderPageAnnots(RenderContext context,
Renderer render)
Render all annotations of a page on render context.
|
Progress |
startRenderPageFormControls(RenderContext context,
Renderer render)
Start rendering a page's form controls in a renderer with a PDF rendering
context.
|
Progress |
startRenderPageSignatures(RenderContext context,
Renderer renderer)
Start to render all signatures of current PDF page with the specified render context and renderer.
|
android.graphics.Matrix |
transformDeviceToPage(android.graphics.Rect srcRect,
android.graphics.RectF dstRect,
int rotation)
Calculate transformation matrix from device coordinate to PDF page
coordinate.
|
android.graphics.Matrix |
transformPageToDevice(android.graphics.RectF srcRect,
android.graphics.Rect dstRect,
int rotation)
Calculate transformation matrix from PDF page coordinate to device
coordinate.
|
void |
unloadAnnots()
Unload annotations of a PDF page.
|
public static final int PARSEFLAG_NORMAL
public static final int PARSEFLAG_TEXTONLY
public static final int ROTATION_0
public static final int ROTATION_90
public static final int ROTATION_180
public static final int ROTATION_270
public static final int RENDERFLAG_NORMAL
public static final int RENDERFLAG_QUICKDRAW
public static final int MARGIN_CONTENTSBBOX
public static final int MARGIN_DETECTION
public static final int BOX_MEDIABOX
public static final int BOX_CROPBOX
public static final int BOX_TRIMBOX
public static final int BOX_ARTBOX
public static final int BOX_BLEEDBOX
public static final int FLATTENFLAG_DISPLAY
This can be combined with any other flatten flag except FLATTENFLAG_PRINT
.
public static final int FLATTENFLAG_PRINT
This can be combined with any other flatten flag except FLATTENFLAG_DISPLAY
.
public static final int FLATTENFLAG_NOANNOT
This should be combined with either FLATTENFLAG_DISPLAY
or FLATTENFLAG_PRINT
.
public static final int FLATTENFLAG_NOFORMCONTROL
This should be combined with either FLATTENFLAG_DISPLAY
or FLATTENFLAG_PRINT
.
public static final int TRIGGER_PAGE_PO
public static final int TRIGGER_PAGE_PC
public long getHandle()
public PDFDocument getDocument()
PDFDocument
object.public boolean isParsed() throws PDFException
boolean
value that receives the current page
parsing state:
true
: the page has been parsed.false
: the page hasn't been parsed.false
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public SizeF getSize() throws PDFException
SizeF
object that receives page width and height,
and unit is 1/72 inch. If there's any error, it will be (0,0).PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
SizeF
public android.graphics.Matrix getDisplayMatrix(int x, int y, int width, int height, int rotation) throws PDFException
x
- Left position of the transformation area in device coordinate,
an integer
value, commonly in pixels.y
- Top position of the transformation area in device coordinate,
an integer
value, commonly in pixels.width
- Horizontal width of the transformation area in device
coordinate, an integer
value, commonly in pixels.height
- Vertical height of the transformation area in device
coordinate, an integer
value, commonly in pixels.rotation
- Page rotation value. Please refer to constant definitions
ROTATION_XXX
and this
should be one of these constants.Matrix
object that receives the transformation
matrix. If there's any error, it will be [1 0 0 1 0 0].PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public int getIndex()
public int getRotation() throws PDFException
integer
value that indicates page rotation state.
Please refer to constant definitions
ROTATION_XXX
and this
should be one of these constants. If there's any error, it will be
-1.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public android.graphics.Matrix transformPageToDevice(android.graphics.RectF srcRect, android.graphics.Rect dstRect, int rotation) throws PDFException
srcRect
- A RectF
object which is a rectangle in PDF page
coordinate.dstRect
- A Rect
object which is a rectangle in device
coordinate.rotation
- Rotation value when parameter srcRect
maps to
dstRect
. Please refer to constant definitions
ROTATION_XXX
and this
should be one of these constants.Matrix
object that receives the transformation
matrix. If there's any error, it will be [1 0 0 1 0 0].PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public android.graphics.Matrix transformDeviceToPage(android.graphics.Rect srcRect, android.graphics.RectF dstRect, int rotation) throws PDFException
srcRect
- A Rect
object which is a rectangle in device
coordinate.dstRect
- A RectF
object which is a rectangle in PDF page
coordinate.rotation
- Rotation value when parameter srcRect
maps to
dstRect
. Please refer to constant definitions
ROTATION_XXX
and this
should be one of these constants.Matrix
object that receives the transformation
matrix. If there's any error, it will be [1 0 0 1 0 0].PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public android.graphics.RectF calcContentBBox(int mode) throws PDFException
mode
- Mode to calculate page margin. Please refer to constant definitions
MARGIN_XXX
and this should be one of these constants.RectF
object that receives the content box
rectangle, in 1/72 inch.
If there's any error, it will be [0 0 0 0].PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public android.graphics.RectF getBox(int boxType) throws PDFException
boxType
- Page box type to an integer
value. Please refer
to constant definitions BOX_XXX
and this should be one of these constants.RectF
object that receives a rectangle value. PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Progress startParse(int flag) throws PDFException
It will take a long time to parse a page with large contents, so Foxit
PDF SDK uses a progressive process.
To execute any page content related process, page should be parsed at
first.
flag
- Page parsing mode: PARSEFLAG_NORMAL
for normal mode, or
PARSEFLAG_TEXTONLY
for text-only mode.Progress
handle that receives a handle of
progressive process.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Progress
public Progress startRender(RenderContext context, Renderer render, int flag) throws PDFException
context
- A RenderContext
object which is a PDF rendering
context.render
- A Renderer
object which represents a rendering
engine.flag
- Page render flag to an integer
value. Please
refer to constant definitions
RENDERFLAG_XXX
and this should be one of these constants.Progress
handle that receives a handle of
progressive process.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Renderer
,
RenderContext
,
Progress
public void loadAnnots() throws PDFException
This function should be called before any other functions in
package are used.com.foxit.gsdk.pdf.annots
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public void unloadAnnots() throws PDFException
This should be called when there's no more operation on annotations in this PDF page.
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Annot[] getAllAnnotsByTabOrder(java.lang.String filter) throws PDFException
This function can support all types defined in constants definitions
except forTYPE_XXX
.Annot.TYPE_POPUP
filter
- A filter string. If it's null
, this function will
get annotations by tab order from all annotations. If it's a valid string,
it specifies annotation type:TYPE_XXX
and it should be one of
these constants. Annot
objects array with specific filter by tab order.
If not found, it will return null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public int countAnnots(java.lang.String filter) throws PDFException
This function can support all types defined in
.Annot.TYPE_XXX
filter
- A String
object.null
, this function will count all
annotations. If it's a valid string, it specifies annotation
type:
Annot.TYPE_XXX
and it should
be one of them. PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public Annot getAnnot(java.lang.String filter, int index) throws PDFException
This function can support all types defined in
.Annot.TYPE_XXX
filter
- A String
object.null
, this function will get annotation
from all annotations. If it's a valid filter, it specifies
annotation type:
Annot.TYPE_XXX
and it should be
one of them.index
- A zero-based index of annotation to be got. Range: 0 to (
annotcount
-1). annotcount
is
returned by function countAnnots(String)
with the same filter
.Annot
object with specified index, by specific
filter. If the parameter index
is out of range, it
will return null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public Annot getAnnotAtPos(java.lang.String filter, android.graphics.PointF pt, float tolerance) throws PDFException
This function can support all types defined in
.Annot.TYPE_XXX
filter
- A String
object.null
,
this function will get annotation from all annotations. If
it's a valid filter, it specifies annotation type:
Annot.TYPE_XXX
and it should be
one of them.
pt
- A PointF
object in PDF page coordinate system.tolerance
- Tolerance value for point, in PDF page coordinate system.
Valid value: from 0.0f to 30.0f.Annot
object at a specific position in PDF page,
by specific filter. It will return null
if not found
the Annot
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public Annot getAnnotAtDevicePos(java.lang.String filter, android.graphics.Matrix matrix, android.graphics.Point pt, float tolerance) throws PDFException
This function can support all types defined in
.Annot.TYPE_XXX
filter
- A String
object.null
,
this function will get annotation from all annotations. If
it's a valid filter, it specifies annotation type:Annot.TYPE_XXX
and it should be
one of them.
matrix
- A Matrix
object used to transform from device
coordinate system to PDF page coordinate system.pt
- A Point
object in device coordinate system.tolerance
- Tolerance value for point, in device coordinate system. Valid
value: from 0.0f to 30.0f.Annot
object at a specific position in device (in
pixel), by specific filter. It will return null
if
not found the Annot
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public Annot addAnnot(android.graphics.RectF rectf, java.lang.String annotType, java.lang.String filter, int index) throws PDFException
This function can support all types defined in
, except
Annot.TYPE_XXX
PSInk
, 3D
, PrinterMark
,
TrapNet
, Sound
, Movie
,
Screen
, Watermark
and Widget
annotations.
For Widget
annotation, user is suggested to use functions in Form
class for most operations of Widget
.
User should use function
in
PSI class to generate a PSI.convertToPDFAnnot(android.graphics.RectF, com.foxit.gsdk.pdf.PDFPage, android.graphics.RectF)
PSInk
annotation object from a
PSI
object.
rectf
- A RectF
object to specify the rectangle of an
annotation, in PDF page coordinate system.Annot.TYPE_TEXT
,
Annot.TYPE_FREETEXT
,
Annot.TYPE_SQUARE
,
Annot.TYPE_CIRCLE
,
Annot.TYPE_FILEATTACHMENT
,
Annot.TYPE_STAMP
,
Annot.TYPE_CARET
.annotType
- A String
object to specify the type of an
annotation. Please refer to Annot.TYPE_XXX
and this should be one of them.filter
.filter
- A String
object.null
, parameter index
is to
all existing annotation.
Annot.TYPE_XXX
and it should be
one of them.index
- The index that this new annotation is to be added in. Range: 0
to (annotcount
-1). annotcount
is
returned by function countAnnots(java.lang.String)
with the same filter
.filter
), the new annotation will be the last one
within the range defined by parameter filter
.Annot
object that has been added.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public void removeAnnot(Annot annot) throws PDFException
This function can support all types defined in
, except
Annot.TYPE_XXX
Watermark
annotation.
For Widget
annotation, this function can remove it but user
is still suggested to use functions in Form class for most operations of
Widget
.
annot
- An Annot
object to be removed.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
public Progress startRenderAnnots(RenderContext context, Renderer render, Annot[] annots) throws PDFException
This function can support all types defined in
, except
Annot.TYPE_XXX
Widget
.
It will take a long time to render annotations with complex or large
contents, so Foxit PDF SDK uses a progressive process.
Caller should use
to
continue rendering in steps, and should call function
Progress.continueProgress(int)
to destroy Progress.release()
Progress
object if rendering process is done.
ATTENTION
: This function doesn't support to render form
field. To render form, please use method
startRenderFormControls(RenderContext, Renderer, PDFFormControl[])
context
- A RenderContext
object which is a PDF render
context object.render
- A Renderer
object which is a renderer object.annots
- Specify an annotation array. Annotations in this array should
be on the same page.Progress
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
RenderContext
,
Renderer
,
Annot
,
Progress
public Progress startRenderPageAnnots(RenderContext context, Renderer render) throws PDFException
This function can support all types defined in
, except
Annot.TYPE_XXX
Widget
.
It will take a long time to render annotations with complex or large
contents, so Foxit PDF SDK uses a progressive process.
Caller should use
to
continue rendering in steps, and should call function
Progress.continueProgress(int)
to destroy Progress.release()
Progress
object if rendering process is done.
ATTENTION
: This function doesn't support to render form
field. To render form, please use method
.startRenderPageFormControls(RenderContext, Renderer)
context
- A RenderContext
object which is a PDF render
context object.render
- A Renderer
object which is a renderer object.Progress
object of progressive process.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
RenderContext
,
Renderer
,
Progress
,
Annot
public void serializeAnnot(Archive archive, Annot annot) throws PDFException
This function can serialize the specified annotation data into memory and
then call function
to
de-serialize annotations to any other PDF pages to recover the
annotations into that page.deserializeAnnot(com.foxit.gsdk.archive.Archive)
archive
- The Archive
object.annot
- The Annot
object to be serialized.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
,
Archive
public Annot deserializeAnnot(Archive archive) throws PDFException
This function can de-serialize the serialized information of annotations'
data into the specified PDF page. Currently, this function doesn't
support to de-serialize annotations of following types:
Watermark
, 3D
, PrinterMark
,
TrapNet
, Sound
, Movie
,
Screen
, PSInk
.
This function should be called after function
.serializeAnnot(com.foxit.gsdk.archive.Archive, com.foxit.gsdk.pdf.annots.Annot)
archive
- The archive
object.Annot
object. If there's any error, it will be
null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Annot
,
Archive
public Progress startRenderFormControls(RenderContext context, Renderer render, PDFFormControl[] formControls) throws PDFException
It will take a long time to render all form controls in a page with
complex or large contents, so Foxit PDF SDK uses a progressive process to
do this.
Caller should use
to
continue rendering in steps, and should call
Progress.continueProgress(int)
to destroy the
Progress.release()
Progress
object if rendering process is over.
context
- A RenderContext
object which is a PDF render
context object.render
- A Renderer
object which is a renderer object.formControls
- A PDFFormControl
array object which is a PDF form
control object.Progress
object of progressive process.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
RenderContext
,
Renderer
,
PDFFormControl
,
Progress
public Progress startRenderPageFormControls(RenderContext context, Renderer render) throws PDFException
Progress.continueProgress(int)
to
continue rendering in steps, and should call
Progress.release()
to destroy the
Progress
object if rendering process is over.context
- a RenderContext object which is a PDF render context object.render
- a Renderer object which is a renderer object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public int countActions(int trigger) throws PDFException
trigger
- The page trigger type. Please refer to constant definitions
TRIGGER_PAGE_XXX
and
this should be one of these constants.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public PDFAction getAction(int trigger, int index) throws PDFException
trigger
- The page trigger type. Please refer to constant definitions
TRIGGER_PAGE_XXX
and this should be one of these constants.index
- Zero-base index to be get.PDFAction
object that receives the page action.null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAction
public void setIndex(int index) throws PDFException
To change page index is just like to move specific PDF page to a new place in current PDF document. So, indexes of PDF pages between old index and new index of specific PDF page will all be changed as well.
index
- New index of page. Range: 0 to (pageCount-1).
pageCount
is returned by function
PDFDocument.countPages()
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFDocument
public void setSize(float width, float height) throws PDFException
PDFDocument.createPage(int)
) can be set any
valid size. For loaded page, new page size cannot be greater than the
old one.width
- A float
value for page width, unit is 1/72 inch.height
- A float
value for page height, unit is 1/72 inch.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setRotation(int rotation) throws PDFException
rotation
- An integer
value for page rotation state. Please
refer to constant definitions
ROTATION_XXX
and this
should be one of these constants.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setBox(int boxType, android.graphics.RectF pageBox) throws PDFException
boxType
- Page area type to an integer value. Please refer to constant
definitions BOX_XXX
and this should be one of these constants.pageBox
- A RectF
object which to be set.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public boolean setAction(int trigger, int index, PDFAction action) throws PDFException
trigger
- The page trigger type. Please refer to constant definitions
TRIGGER_PAGE_XXX
and this should be one of these constants.index
- Index of trigger action. Range: 0 to (actioncount-1).
actioncount
is returned by function
countActions(int)
.action
- A PDFAction
object which to be set.true
if set successfully, else return
false
for failure.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 page trigger type. Please refer to constant definitions
TRIGGER_PAGE_XXX
and this should be one of these constants.index
- Zero-base index to be inserted. Range: 0 to (actionCount-1).
actionCount
is returned by function
countActions(int)
. If parameter
index
is out of range or no action is found, the
action
will be inserted to the last.action
- A PDFAction
object which to be inserted.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAction
public boolean removeAction(int trigger, int index) throws PDFException
trigger
- The page trigger type. Please refer to constant definitions
TRIGGER_PAGE_XXX
and this should be one of these constants.index
- index of trigger action which is to be removed. Range: 0 to
(actionCount-1). actionCount
is returned by
function countActions(int)
.true
if removed the specified action successfully,
else return false
for not found the action specified
by parameter index
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public boolean removeAllActions(int trigger) throws PDFException
trigger
- The page trigger type. Please refer to constant definitions
TRIGGER_PAGE_XXX
and this should be one of these constants.true
if removed all actions successfully, else
return false
for not found the action.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void flatten(int flags) throws PDFException
When this function is finished successfully,
please call function startParse(int)
to parse page again.
flags
- The flatten option. Please refer to constant definitions
FLATTENFLAG_XXX
and this should be one or combination of these constants.FLATTENFLAG_NOANNOT
and
FLATTENFLAG_NOFORMCONTROL
at the same time,
it means nothing should be flattened,
and this function will finish without doing anything.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public boolean doJavaScriptAction(int trigger) throws PDFException
PDFDocument.loadForm()
, and
PDFDocument.initiateJavaScript()
, or it will return
PDFException.ERRCODE_ERROR
.trigger
- Type of the trigger event. Please refer to constant
definitions
TRIGGER_XXX
and
this should be one of these constants.true
if do the action successfully, else return
false
for failure.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public PageObjects getPageObjects() throws PDFException
To call this function, The PDFPage
object should be parsed.
Please refer to function
for
how to parse a PDF page.startParse(int)
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PageObjects
public void removeWatermarks() throws PDFException
To remove watermarks, application should ensure that current page has been parsed successfully.
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFWatermark
public boolean removeWatermark(int index) throws PDFException
To remove watermarks, application should ensure that
current page has been parsed successfully. And there's
no need to call function
at first for watermarks which are annotations.loadAnnots()
index
- The index of watermark of page. Range: 0 to (WatermarkCount-1).
WatermarkCount
is returned by function countWatermarks()
true
if remove the specific watermark successfully,
while false
for failure.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public int countWatermarks() throws PDFException
To get the count of watemarks, application should ensure that current page has been parsed successfully.
integer
value that receives the count of watermarks.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Progress startRenderPageSignatures(RenderContext context, Renderer renderer) throws PDFException
Caller should use
to
continue rendering in steps, and should call function
Progress.continueProgress(int)
to destroy Progress.release()
Progress
object if rendering process is done.
context
- A RenderContext
object which is a PDF render context object.renderer
- A Renderer
object which is a renderer object.Progress
object of progressive process.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.RenderContext
,
Renderer
,
Progress
,
PDFException
public Signature addSignature(android.graphics.RectF rect) throws PDFException
rect
- A RectF
object to specify rectangle position
of new signature in PDF page, in PDF page coordinate system.Signature
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.Signature
,
PDFException