public class PDFReflowPage
extends java.lang.Object
PDFReflowPage
represents a reflow page of a PDF page.
Reflow page will rearrange the content of parsed PDF pages, reparse PDF pages, which have been already parsed, according to the user's required page size and final to render a reflowed page to the demanded device.
It can be constructed in the following ways.
Example:
PDFDocument document = PDFDocument.open(file,password); PDFPage page = document.getPage(0); PDFReflowPage reflowPage = PDFReflowPage.create(page)
PDFDocument
,
PDFPage
Modifier and Type | Field and Description |
---|---|
static int |
REFLOWFLAG_IMAGE
Reflow parsing flag for image mode.
|
static int |
REFLOWFLAG_NORMAL
Reflow parsing flag for normal mode, without image.
|
Modifier and Type | Method and Description |
---|---|
static PDFReflowPage |
create(PDFPage page)
Create a
PDFReflowPage object from specified
PDFPage object. |
SizeF |
getContentSize()
Get width and height of a reflow page after calling function
. |
java.lang.String |
getFocusData(Matrix matrix,
java.awt.Point point)
Get focus data corresponding to a given position in device coordinate
system.
|
java.awt.Point |
getFocusPos(Matrix matrix,
java.lang.String focusData)
Get a point position in device coordinate system which corresponds to a
given focus data.
|
long |
getHandle()
Get a reflow page handle.
|
Matrix |
getMatrix(int x,
int y,
int width,
int height,
int rotation)
Get matrix of a
PDFReflowPage object. |
void |
release()
Release all resources allocated for a
PDFReflowPage handle. |
void |
setLineSpace(float lineSpace)
Set line space before calling function
. |
void |
setSize(float width,
float height)
Set screen size before calling function
. |
Progress |
startParse(int flags)
Start parsing process for a
PDFReflowPage object. |
Progress |
startRender(RenderContext context,
Renderer render)
Start rendering a reflowed page.
|
public static final int REFLOWFLAG_NORMAL
public static final int REFLOWFLAG_IMAGE
public long getHandle()
public static PDFReflowPage create(PDFPage page) throws PDFException
PDFReflowPage
object from specified
PDFPage
object.page
- A PDFPage
object.PDFReflowPage
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFPage
public void release() throws PDFException
PDFReflowPage
handle.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Matrix getMatrix(int x, int y, int width, int height, int rotation) throws PDFException
PDFReflowPage
object.x
- Left pixel position of the display area in the device
coordinate system.y
- Top pixel position of the display area in the device
coordinate system.width
- Horizontal size (in pixels) to display the page.height
- Vertical size (in pixels) to display the page.rotation
- Page orientation. Valid values are:
Matrix
object that receives the output matrix.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setLineSpace(float lineSpace) throws PDFException
startParse(int)
.lineSpace
- The line space. Default value: 0.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setSize(float width, float height) throws PDFException
startParse(int)
.width
- Width of desired page. This value should be more than 20.height
- Height of desired page. This value should be more than 20.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public SizeF getContentSize() throws PDFException
startParse(int)
.SizeF
object that receives the width and height of
reflow page.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
SizeF
public java.lang.String getFocusData(Matrix matrix, java.awt.Point point) throws PDFException
matrix
- A Matrix
object returned by function
getMatrix
.point
- A Point
object that is a specific position, in
device coordinate system.String
object that receives the focus data
corresponding to the specific position.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public java.awt.Point getFocusPos(Matrix matrix, java.lang.String focusData) throws PDFException
matrix
- A Matrix
object returned by function
getMatrix(int, int, int, int, int)
.focusData
- Focus data used to get its corresponding position in device
coordinate system, with specific matrix. This is returned by
function getFocusData(Matrix, Point)
.Point
object that receives the position
corresponding to the specific focus data.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Progress startParse(int flags) throws PDFException
PDFReflowPage
object.
It may take a long time for parsing a reflow page, so Foxit PDF SDK uses
a progressive process.
All the resources about reflow page will be loaded after the reflow page
is parsed.
Function
must be
called before this function to set the screen size. And this function
should be called before any method of the reflow module can be used.setSize(float, float)
flags
- Reflow parsing mode. It should be one of the followings:
Progress
object that receives a handle of
progressive process if success.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Progress
public Progress startRender(RenderContext context, Renderer render) throws PDFException
It will take a long time to render a reflowed page with complex or large
contents, so Foxit PDF SDK uses a progressive process.
context
- Handle to a RenderContext
object which is a PDF
rendering context.render
- Handle to a Renderer
object which represents a
rendering engine.Progress
object that receives a handle of
progressive process if successful.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Progress
,
RenderContext
,
Renderer