Public Types | |
enum | Flags { e_Normal = 0x0, e_WithImage = 0x1, e_NoTruncate = 0x2 } |
Enumeration for parsing flags used for a reflow page. More... | |
Public Member Functions | |
ReflowPage (const PDFPage &page) | |
Constructor, from a parsed PDF page. More... | |
ReflowPage (const ReflowPage &other) | |
Constructor, with another ReflowPage object. More... | |
~ReflowPage () | |
Destructor. | |
float | GetContentHeight () const |
Get content height after current reflow page object has been parsed. More... | |
float | GetContentWidth () const |
Get content width after current reflow page object has been parsed. More... | |
Matrix | GetDisplayMatrix (float offset_x, float offset_y) const |
Get the display matrix, according to the offset of top side between current reflow page and screen. More... | |
String | GetFocusData (const Matrix &matrix, const PointF &point) const |
Get focus data corresponding to a given position in device coordinate system. More... | |
PointF | GetFocusPosition (const Matrix &matrix, const char *focus_data) const |
Get the position in device coordinate system corresponding to a given focus data. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | IsParsed () const |
Check if current reflow page has been parsed or not. More... | |
bool | operator!= (const ReflowPage &other) const |
Not equal operator. More... | |
ReflowPage & | operator= (const ReflowPage &other) |
Assign operator. More... | |
bool | operator== (const ReflowPage &other) const |
Equal operator. More... | |
void | SetLineSpace (float line_space) |
Set line space. This can be called before calling function ReflowPage::StartParse. More... | |
void | SetParseFlags (uint32 flags) |
Set the parsing flag. This can be called before calling function ReflowPage::StartParse. More... | |
void | SetScreenMargin (int left, int top, int right, int bottom) |
Set margin. This can be called before calling function ReflowPage::StartParse. More... | |
void | SetScreenSize (float width, float height) |
Set screen size. This should be called before calling function ReflowPage::StartParse. More... | |
void | SetTopSpace (float top_space) |
Set the top space. This can be called before calling function ReflowPage::StartParse. More... | |
void | SetZoom (int zoom) |
Set zoom factor. This can be called before calling function ReflowPage::StartParse. More... | |
common::Progressive | StartParse (common::PauseCallback *pause=0) |
Start to parse current reflow page. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
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 ReflowPage 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.
Enumeration for parsing flags used for a reflow page.
Values of this enumeration can be used alone or in combination.
|
explicit |
Constructor, from a parsed PDF page.
[in] | page | A valid PDF page object which has been parsed. |
foxit::pdf::ReflowPage::ReflowPage | ( | const ReflowPage & | other | ) |
Constructor, with another ReflowPage object.
[in] | other | Another ReflowPage object. |
float foxit::pdf::ReflowPage::GetContentHeight | ( | ) | const |
Get content height after current reflow page object has been parsed.
float foxit::pdf::ReflowPage::GetContentWidth | ( | ) | const |
Get content width after current reflow page object has been parsed.
Matrix foxit::pdf::ReflowPage::GetDisplayMatrix | ( | float | offset_x, |
float | offset_y | ||
) | const |
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.
[in] | offset_x | Offset value, which means the offset from top side of current reflow page to the top side of screen. |
[in] | offset_y | Offset value, which means the offset from left side of current reflow page to the left side of screen. |
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.
[in] | matrix | A matrix returned by function ReflowPage::GetDisplayMatrix. |
[in] | point | The point of a specified position, in device coordinate system. |
PointF foxit::pdf::ReflowPage::GetFocusPosition | ( | const Matrix & | matrix, |
const char * | focus_data | ||
) | const |
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.
[in] | matrix | A matrix returned by function ReflowPage::GetDisplayMatrix. |
[in] | focus_data | Focus data used to get its corresponding position in device coordinate system, with specified matrix. This is retrieved by previous calling of function ReflowPage::GetFocusData. |
bool foxit::pdf::ReflowPage::IsEmpty | ( | ) | const |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
bool foxit::pdf::ReflowPage::IsParsed | ( | ) | const |
Check if current reflow page has been parsed or not.
bool foxit::pdf::ReflowPage::operator!= | ( | const ReflowPage & | other | ) | const |
Not equal operator.
[in] | other | Another ReflowPage object. This function will check if current object is not equal to this one. |
ReflowPage& foxit::pdf::ReflowPage::operator= | ( | const ReflowPage & | other | ) |
Assign operator.
[in] | other | Another ReflowPage object, whose value would be assigned to current object. |
bool foxit::pdf::ReflowPage::operator== | ( | const ReflowPage & | other | ) | const |
Equal operator.
[in] | other | Another ReflowPage object. This function will check if current object is equal to this one. |
void foxit::pdf::ReflowPage::SetLineSpace | ( | float | line_space | ) |
Set line space. This can be called before calling function ReflowPage::StartParse.
[in] | line_space | The line space. This value should between -25 to (height/2). If no line space is set, value 0 will be used by default. |
void foxit::pdf::ReflowPage::SetParseFlags | ( | uint32 | flags | ) |
Set the parsing flag. This can be called before calling function ReflowPage::StartParse.
[in] | flags | Parsing flags. Please refer to values starting from ReflowPage::e_Normal and this should be one or a combination of these values. If no parsing flag is set, value ReflowPage::e_Normal will be used by default. |
void foxit::pdf::ReflowPage::SetScreenMargin | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
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.
[in] | left | The left margin. This value should between 0 and (screen width / 3). |
[in] | top | The left margin. This value should between 0 and (screen height/ 3). |
[in] | right | The left margin. This value should between 0 and (screen width / 3). |
[in] | bottom | The left margin. This value should between 0 and (screen height / 3). |
void foxit::pdf::ReflowPage::SetScreenSize | ( | float | width, |
float | height | ||
) |
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.
[in] | width | The screen width. |
[in] | height | The screen height. |
void foxit::pdf::ReflowPage::SetTopSpace | ( | float | top_space | ) |
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.
[in] | top_space | The top space. This value should between 0 and height. If no top space is set, value 0 will be used by default. |
void foxit::pdf::ReflowPage::SetZoom | ( | int | zoom | ) |
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.
[in] | zoom | Zoom 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. |
common::Progressive foxit::pdf::ReflowPage::StartParse | ( | common::PauseCallback * | pause = 0 | ) |
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.
[in] | pause | Pause 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. |