com.foxit.sdk.pdf.ReflowPage Class Reference
Inheritance diagram for com.foxit.sdk.pdf.ReflowPage:
com.foxit.sdk.common.Base

Public Member Functions

 ReflowPage (PDFPage page) throws com.foxit.sdk.PDFException
 Constructor, from a parsed PDF page.
More...
 
 ReflowPage (ReflowPage other)
 Constructor, with another reflow page object.
More...
 
float getContentHeight () throws com.foxit.sdk.PDFException
 Get content height after current reflow page object has been parsed.
More...
 
float getContentWidth () throws com.foxit.sdk.PDFException
 Get content width after current reflow page object has been parsed.
More...
 
Matrix2D getDisplayMatrix (float offset_x, float offset_y) throws com.foxit.sdk.PDFException
 Get the display matrix, according to the offset of top side between current reflow page and screen.
More...
 
String getFocusData (Matrix2D matrix, PointF point) throws com.foxit.sdk.PDFException
 Get focus data corresponding to a given position in device coordinate system.
More...
 
PointF getFocusPosition (Matrix2D matrix, String focus_data) throws com.foxit.sdk.PDFException
 Get the position in device coordinate system corresponding to a given focus data.
More...
 
boolean isEmpty ()
 Check whether current object is empty or not.
More...
 
boolean isParsed () throws com.foxit.sdk.PDFException
 Check if current reflow page has been parsed or not.
More...
 
void setLineSpace (float line_space) throws com.foxit.sdk.PDFException
 Set line space. This can be called before calling function ReflowPage.startParse .
More...
 
void setParseFlags (int flags) throws com.foxit.sdk.PDFException
 Set the parsing flag. This can be called before calling function ReflowPage.startParse .
More...
 
void setScreenMargin (int left, int top, int right, int bottom) throws com.foxit.sdk.PDFException
 Set margin. This can be called before calling function ReflowPage.startParse .
More...
 
void setScreenSize (float width, float height) throws com.foxit.sdk.PDFException
 Set screen size. This should be called before calling function ReflowPage.startParse .
More...
 
void setTopSpace (float top_space) throws com.foxit.sdk.PDFException
 Set the top space. This can be called before calling function ReflowPage.startParse .
More...
 
void setZoom (int zoom) throws com.foxit.sdk.PDFException
 Set zoom factor. This can be called before calling function ReflowPage.startParse .
More...
 
Progressive startParse (PauseCallback pause) throws com.foxit.sdk.PDFException
 Start to parse current reflow page.
More...
 

Static Public Attributes

static final int e_Normal = 0x0
 Parsing flag for normal mode, without image.

 
static final int e_NoTruncate = 0x2
 Parsing flag to decide whether to allow to truncate the first/last image or line of text within the specified screen size or not.
More...
 
static final int e_WithImage = 0x1
 Parsing flag for image mode.

 

Detailed Description

In order to display page contents in a small screen device, Foxit PDF SDK introduces the concept of "reflow page". In the reflow page, original PDF page contents will be laid out to fit the specified screen size.
For a PDF page, user may wants to keep focusing on a location in the reflow page when user switches between this PDF page and its related reflow page, or switch among these related reflow pages which are in different size. In order to track the focus location, Foxit PDF SDK uses "focus data" to represent the focus location. Focus data is similar to bookmark or destination in PDF, but it is simpler. User can store the focus data (or save the data to file) so that use can retrieved the focus location again by the focus data later, even if the size of reflow page is changed.
A reflow page object should be constructed from a parsed PDF page. This class offers functions to:

To render the reflow page, please use function common.Renderer.startRenderReflowPage .

See also
PDFPage
com.foxit.sdk.common.Renderer

Constructor & Destructor Documentation

◆ ReflowPage() [1/2]

com.foxit.sdk.pdf.ReflowPage.ReflowPage ( PDFPage  page) throws com.foxit.sdk.PDFException

Constructor, from a parsed PDF page.

Parameters
[in]pageA valid PDF page object which has been parsed.

◆ ReflowPage() [2/2]

com.foxit.sdk.pdf.ReflowPage.ReflowPage ( ReflowPage  other)

Constructor, with another reflow page object.

Parameters
[in]otherAnother reflow page object.

Member Function Documentation

◆ getContentHeight()

float com.foxit.sdk.pdf.ReflowPage.getContentHeight ( ) throws com.foxit.sdk.PDFException

Get content height after current reflow page object has been parsed.

Returns
Content height.

◆ getContentWidth()

float com.foxit.sdk.pdf.ReflowPage.getContentWidth ( ) throws com.foxit.sdk.PDFException

Get content width after current reflow page object has been parsed.

Returns
Content width.

◆ getDisplayMatrix()

Matrix2D com.foxit.sdk.pdf.ReflowPage.getDisplayMatrix ( float  offset_x,
float  offset_y 
) throws com.foxit.sdk.PDFException

Get the display matrix, according to the offset of top side between current reflow page and screen.

This function can only be used when reflow page has been parsed.

Parameters
[in]offset_xOffset value, which means the offset from top side of current reflow page to the top side of screen.
[in]offset_yOffset value, which means the offset from left side of current reflow page to the left side of screen.
Returns
The display matrix.

◆ getFocusData()

String com.foxit.sdk.pdf.ReflowPage.getFocusData ( Matrix2D  matrix,
PointF  point 
) throws com.foxit.sdk.PDFException

Get focus data corresponding to a given position in device coordinate system.

This function can only be used when reflow page has been parsed.
Focus data, similar to bookmark or destination in PDF, is used to locate the position of a specified content in reflow page. For a PDF page, position of a specified content is fixed and will not be changed even if the size of related reflow page is changed. So focus data can be used to locate the same content from a PDF page in its related reflow pages with different sizes but same reflow content.
Usually, user can call function ReflowPage.getFocusData to get focus data for a specified location, and store the focus data. When the reflow page's size is changed, user can use the stored focus data in function ReflowPage.getFocusPosition to get the new position and then still focus on or near the same content.

Parameters
[in]matrixA matrix returned by function ReflowPage.getDisplayMatrix .
[in]pointThe point of a specified position, in device coordinate system.
Returns
The focus data.

◆ getFocusPosition()

PointF com.foxit.sdk.pdf.ReflowPage.getFocusPosition ( Matrix2D  matrix,
String  focus_data 
) throws com.foxit.sdk.PDFException

Get the position in device coordinate system corresponding to a given focus data.

This function can only be used when reflow page has been parsed.
Focus data, similar to bookmark or destination in PDF, is used to locate the position of a specified content in reflow page. For a PDF page, position of a specified content is fixed and will not be changed even if the size of related reflow page is changed. So focus data can be used to locate the same content from a PDF page in its related reflow pages with different sizes but same reflow content.
Usually, user can call function ReflowPage.getFocusData to get focus data for a specified location, and store the focus data. When the reflow page's size is changed, user can use the stored focus data in function ReflowPage.getFocusPosition to get the new position and then still focus on or near the same content.

Parameters
[in]matrixA matrix returned by function ReflowPage.getDisplayMatrix .
[in]focus_dataFocus data used to get its corresponding position in device coordinate system, with specified matrix. This is retrieved by previous calling of function ReflowPage.getFocusData .
Returns
The position in device coordinate system.

◆ isEmpty()

boolean com.foxit.sdk.pdf.ReflowPage.isEmpty ( )

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ isParsed()

boolean com.foxit.sdk.pdf.ReflowPage.isParsed ( ) throws com.foxit.sdk.PDFException

Check if current reflow page has been parsed or not.

Returns
true means current reflow page has been parsed, while false means current page has not been parsed yet.

◆ setLineSpace()

void com.foxit.sdk.pdf.ReflowPage.setLineSpace ( float  line_space) throws com.foxit.sdk.PDFException

Set line space. This can be called before calling function ReflowPage.startParse .

Parameters
[in]line_spaceThe line space. This value should between -25 to (height/2).
If no line space is set, value 0 will be used by default.
Returns
None.

◆ setParseFlags()

void com.foxit.sdk.pdf.ReflowPage.setParseFlags ( int  flags) throws com.foxit.sdk.PDFException

Set the parsing flag. This can be called before calling function ReflowPage.startParse .

Parameters
[in]flagsParsing flags. Please refer to values starting from com.foxit.sdk.pdf.ReflowPage.e_Normal and this should be one or a combination of these values. If no parsing flag is set, value com.foxit.sdk.pdf.ReflowPage.e_Normal will be used by default.
Returns
None.

◆ setScreenMargin()

void com.foxit.sdk.pdf.ReflowPage.setScreenMargin ( int  left,
int  top,
int  right,
int  bottom 
) throws com.foxit.sdk.PDFException

Set margin. This can be called before calling function ReflowPage.startParse .

If no margin has ever been set to current reflow page, Foxit PDF SDK will use value (0, 0, 0, 0) as default margin.
If new margin is set, the new margin will take effect until current reflow page has been re-parsed and rendered again.

Parameters
[in]leftThe left margin. This value should between 0 and (screen width / 3).
[in]topThe left margin. This value should between 0 and (screen height/ 3).
[in]rightThe left margin. This value should between 0 and (screen width / 3).
[in]bottomThe left margin. This value should between 0 and (screen height / 3).
Returns
None.

◆ setScreenSize()

void com.foxit.sdk.pdf.ReflowPage.setScreenSize ( float  width,
float  height 
) throws com.foxit.sdk.PDFException

Set screen size. This should be called before calling function ReflowPage.startParse .

Before paring a reflow page, user should call this function to set the screen size for parsing the reflow page.

Parameters
[in]widthThe screen width.
[in]heightThe screen height.
Returns
None.

◆ setTopSpace()

void com.foxit.sdk.pdf.ReflowPage.setTopSpace ( float  top_space) throws com.foxit.sdk.PDFException

Set the top space. This can be called before calling function ReflowPage.startParse .

This function is used to set the distance between the page's top and the screen's top. The distance will take effect when parsing a reflow page.

Parameters
[in]top_spaceThe top space. This value should between 0 and height.
If no top space is set, value 0 will be used by default.
Returns
None.

◆ setZoom()

void com.foxit.sdk.pdf.ReflowPage.setZoom ( int  zoom) throws com.foxit.sdk.PDFException

Set zoom factor. This can be called before calling function ReflowPage.startParse .

If no zoom factor has ever been set to current reflow page, Foxit PDF SDK will use value 100 as default zoom factor, which means 100%.
If new zoom factor is set, the new zoom factor will take effect until current reflow page has been re-parsed and rendered again.

Parameters
[in]zoomZoom factor. The value represents the percent value, for example, 100 means 100%. This value should between 25 and 1000.
If no zoom factor is set, value 100 will be used by default.
Returns
None.

◆ startParse()

Progressive com.foxit.sdk.pdf.ReflowPage.startParse ( PauseCallback  pause) throws com.foxit.sdk.PDFException

Start to parse current reflow page.

It may take a long time to parsing a reflow page, so Foxit PDF SDK uses a progressive process to do this. All the resources about reflow page will be loaded after the reflow page is parsed.
This function should be called before any getting function of current reflow page object can be used.

Parameters
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to coninue the progress until the progress is finished.

Member Data Documentation

◆ e_NoTruncate

final int com.foxit.sdk.pdf.ReflowPage.e_NoTruncate = 0x2
static

Parsing flag to decide whether to allow to truncate the first/last image or line of text within the specified screen size or not.

The height of final parsed reflow page may be larger than the actual screen height. In this case, the content of a reflow page would be shown in more than one screen in application.
Application may use following modes to show such reflow page:

  • Show only part of content of the reflow page in the screen in one time. When user clicks or taps, show the previous or next part of content. This is like to turn to a page in a real book. Here, call this mode as "single screen mode".
  • Show the reflow page continuously – that means user can scroll the screen to see any part of content in this reflow page. Here, call this mode as "scroll screen mode".

If use "single screen mode" to show a reflow page, a truncate problem may occurs: the first line of text or image just shows the bottom half in the top of the screen, or the last line of text of image just shows the top half in the bottom of the screen. This flag can be set to avoid such problem.
If use "scroll screen mode", no need to use this flag.