public class PageObjects
extends java.lang.Object
PageObjects
represents a PDF PageObjects.
The PageObjects
class defines methods to count or insert page objects,
generate page content.
Function
can get the count of page
objects with specific type.
countObjects(int)
can insert a page
object and it will be automatically freed.
insertObject(int, int, PageObject)
can generate PDF Page content.generateContents()
Modifier and Type | Method and Description |
---|---|
int |
countObjects(int typeFilter)
Get the count of page objects with specific type.
|
void |
generateContents()
Generate PDF Page content.
|
PageObject |
getObject(int typeFilter,
int index)
Get a specified page object from page objects.
|
void |
insertObject(int typeFilter,
int index,
PageObject pageObject)
Insert a page object and it will be automatically freed.
|
void |
removeObject(PageObject pageObject)
Remove a page object.
|
public int countObjects(int typeFilter) throws PDFException
Count all page objects including the unsupported page object if parameter
typeFilter
is
.PageObject.TYPE_ALL
typeFilter
- A filter flag which specifies what type of page objects is to
be counted out. Please refer to constant definitions
TYPE_XXX
and this should be
one of these constants. Currently, it doesn't support
PageObject.TYPE_TEXT
,
PageObject.TYPE_SHADING
and
PageObject.TYPE_FORMXOBJECT
type.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PageObject
public PageObject getObject(int typeFilter, int index) throws PDFException
If parameter typeFilter
is
, parameter PageObject.TYPE_ALL
index
is
for all page objects.
typeFilter
- A filter flag for the type of page objects. Please refer to
constant definitions TYPE_XXX
and this should be one of these constants.
Currently, it doesn't support PageObject.TYPE_TEXT
,PageObject.TYPE_SHADING
and
PageObject.TYPE_FORMXOBJECT
type.index
- Index of page object. Range: 0 to (objCount-1).
objCount
is returned by function
countObjects(int)
.PageObject
object that receives a specific page object.
If not found, it will be null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PageObject
public void insertObject(int typeFilter, int index, PageObject pageObject) throws PDFException
If parameter typeFilter
is
, parameter PageObject.TYPE_ALL
index
is
for all page objects. Parameter pageObject
can be returned
by function
or
ImageObject.create(PDFPage)
.PathObject.create(PDFPage)
typeFilter
- A filter flag for the type of page objects. Please refer to
constant definitions TYPE_XXX
and this should be one of these constants.
Currently, it doesn't support
PageObject.TYPE_TEXT
,
PageObject.TYPE_SHADING
and
PageObject.TYPE_FORMXOBJECT
type.index
- Index of page object. Range: 0 to (objcount-1).
objcount
is returned by function
countObjects(int)
. If index
is
larger than (objcount-1), pageObject
will be
inserted to be the last one. if index
is smaller
than 0, pageObject
will be inserted to be the
first one.pageObject
- A PageObject
object which is a page object. It
should be valid and match with the typeFilter
type.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PageObject
,
ImageObject
,
PathObject
public void generateContents() throws PDFException
Application must call this function before saving the page to a file or reload the page, otherwise all changes to the page objects will be lost.
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void removeObject(PageObject pageObject) throws PDFException
pageObject
- A PageObject
object. It should be valid.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException