Public Types | |
enum | TextParseFlags { e_ParseTextNormal = 0x0000, e_ParseTextOutputHyphen = 0x0001, e_ParseTextUseStreamOrder = 0x0002 } |
Enumeration for parsing flags used for text page. More... | |
Public Member Functions | |
TextPage (const PDFPage &page, int flags=foxit::pdf::TextPage::e_ParseTextNormal) | |
Constructor, from a parsed PDF page. More... | |
TextPage (const TextPage &other) | |
Constructor, with another text page object. More... | |
~TextPage () | |
Destructor. | |
common::Rotation | GetBaselineRotation (int rect_index) |
Get the text trend (as rotation) of a specified rectangle. More... | |
int | GetCharCount () const |
Get the count of all the characters. More... | |
WString | GetChars (int start=0, int count=-1) const |
Get all the characters within a range specified by a start index and count. More... | |
int | GetIndexAtPos (float x, float y, float tolerance) const |
Get the character index at or around a specified position on the page, in PDF coordinate system. More... | |
WString | GetTextInRect (const RectF &rect) const |
Get the text within a rectangle, in PDF coordinate system. More... | |
RectF | GetTextRect (int rect_index) const |
Get the text rectangle by the index. More... | |
RectFArray | GetTextRectArrayByRect (const RectF rect) |
Get the array of all text rectangles within the specified rectangle region. More... | |
int | GetTextRectCount (int start=0, int count=-1) |
Count the text rectangles within a range specified by a start index and count. More... | |
common::Range | GetWordAtPos (float x, float y, float tolerance) const |
Get the character range of a word at or around a specified position on the page, in PDF coordinate system. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | operator!= (const TextPage &other) const |
Not equal operator. More... | |
TextPage & | operator= (const TextPage &other) |
Assign operator. More... | |
bool | operator== (const TextPage &other) const |
Equal operator. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
PDF text page represents all the text contents in a PDF page, according to a specified parsing flag for these text. Class TextPage can be used to retrieve information about text in a PDF page, such as single character, single word, text content within specified character range or rectangle and so on.
This class object can also be used to construct objects of other text related classes in order to do more operation for text contents or access specified information from text contents:
Enumeration for parsing flags used for text 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. This page should has been parsed. |
[in] | flags | Parsing flags for the text page. Please refer to values starting from TextPage::e_ParseTextNormal and this can be one or combination of these values. |
foxit::pdf::TextPage::TextPage | ( | const TextPage & | other | ) |
Constructor, with another text page object.
[in] | other | Another text page object. |
common::Rotation foxit::pdf::TextPage::GetBaselineRotation | ( | int | rect_index | ) |
Get the text trend (as rotation) of a specified rectangle.
[in] | rect_index | The index of the rectangle to be retrieved. Valid range: from 0 to (count -1). count is returned by function TextPage::GetTextRectCount. |
int foxit::pdf::TextPage::GetCharCount | ( | ) | const |
Get the count of all the characters.
WString foxit::pdf::TextPage::GetChars | ( | int | start = 0 , |
int | count = -1 |
||
) | const |
Get all the characters within a range specified by a start index and count.
[in] | start | Index of start character, which is the first character of the expected text content. Valid range: from 0 to (charcount -1). charcount is returned by function TextPage::GetCharCount. Default value: 0. |
[in] | count | Count of characters to be retrieved. -1 means to get the whole characters from start_index to the end of PDF page. Especially, when parameter count is larger than (charcount - start), all the rest character (from start_index) will be retrieved. charcount is returned by function TextPage::GetCharCount. Default value: -1. |
int foxit::pdf::TextPage::GetIndexAtPos | ( | float | x, |
float | y, | ||
float | tolerance | ||
) | const |
Get the character index at or around a specified position on the page, in PDF coordinate system.
[in] | x | Value of x position, in PDF coordinate system. |
[in] | y | Value of y position, in PDF coordinate system. |
[in] | tolerance | Tolerance value for character hit detection, in point units. This should not be a negative. |
Get the text within a rectangle, in PDF coordinate system.
[in] | rect | A rectangle region, in PDF coordinate system. |
RectF foxit::pdf::TextPage::GetTextRect | ( | int | rect_index | ) | const |
Get the text rectangle by the index.
[in] | rect_index | The index of the rectangle to be retrieved. Valid range: from 0 to (count -1). count is returned by function TextPage::GetTextRectCount. |
RectFArray foxit::pdf::TextPage::GetTextRectArrayByRect | ( | const RectF | rect | ) |
Get the array of all text rectangles within the specified rectangle region.
[in] | rect | A rectangle region, in PDF coordinate system. |
int foxit::pdf::TextPage::GetTextRectCount | ( | int | start = 0 , |
int | count = -1 |
||
) |
Count the text rectangles within a range specified by a start index and count.
[in] | start | Index of start character in the character index range. Valid range: from 0 to (charcount -1). charcount is returned by function TextPage::GetCharCount. |
[in] | count | Count of characters in the character index range. -1 means to get the whole characters from start_index to the end of PDF page. |
common::Range foxit::pdf::TextPage::GetWordAtPos | ( | float | x, |
float | y, | ||
float | tolerance | ||
) | const |
Get the character range of a word at or around a specified position on the page, in PDF coordinate system.
Currently, for Chinese/Japanese/Korean, only support to get a single character at or around the specified position.
[in] | x | Value of x position, in PDF coordinate system. |
[in] | y | Value of y position, in PDF coordinate system. |
[in] | tolerance | Tolerance value for word hit detection, in point units.This should not be a negative. |
bool foxit::pdf::TextPage::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::TextPage::operator!= | ( | const TextPage & | other | ) | const |
Not equal operator.
[in] | other | Another text page object. This function will check if current object is not equal to this one. |
Assign operator.
[in] | other | Another text page object, whose value would be assigned to current object. |
bool foxit::pdf::TextPage::operator== | ( | const TextPage & | other | ) | const |
Equal operator.
[in] | other | Another text page object. This function will check if current object is equal to this one. |