Foxit::PDF::TextPage Class Reference

Class to represent text page. More...

Public Member Functions

Boolean Release ()
 Release all resources. More...
 
int32 CountChars ()
 Get count of characters in current text page. More...
 
String^ GetChars (CharRange^ charRange)
 Get text content in current text page, within a specified character range. More...
 
CharInfoGetCharInfo (int32 charIndex)
 Get character information of a specific character. More...
 
int32 GetCharIndexAtPos (float32 x, float32 y, float32 tolerance)
 Get the character index at or near a specific position in PDF page. More...
 
TextSelectionSelectByRange (CharRange^ charRange)
 Get a text selection object by a specified character range. More...
 
TextSelectionSelectByRectangle (RectF^ rect)
 Get a text selection handle by specific rectangle. More...
 
TextSearchStartSearch (String^ searchPattern, uint32 flags, int32 startIndex)
 Start a PDF text search process. More...
 
int32 CountLinks ()
 Count the URL formatted texts in current text page. More...
 
String^ GetLink (int32 linkIndex)
 Get the linked URL associated with a specific hyperlink. More...
 
TextSelectionGetLinkSelection (int32 linkIndex)
 Get a text selection object for a specific hyperlink. More...
 

Properties

int64 pointer
 Pointer to a handle of PDF text page object. This pointer is not useful outside this SDK. The application should not access the pointer to the handle of the PDF text page object directly.
 
int64 linkPointer
 Pointer to a handle of PDF text link internal object. This pointer is not useful outside this SDK. The application should not access the pointer to the handle of the PDF text link object directly.
 

Detailed Description

Class to represent text page.

Text page contains all the text contents of a PDF page and can be used for text related operation such as retrieving characters data or text content, starting to search text, selecting some text and etc. Text page object can be loaded by function Page::LoadTextPage.

Member Function Documentation

int32 Foxit::PDF::TextPage::CountChars ( )

Get count of characters in current text page.

Generated characters, such as additional space and new line characters, are also counted.
Characters in a page are from a "stream". Inside the stream, each character has an index. This index is used in most PDF text page related functions and the first character in the page has an index value of zero.

Returns
The count of characters in the page. If an error occurs, this will be set to -1.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
int32 Foxit::PDF::TextPage::CountLinks ( )

Count the URL formatted texts in current text page.

Returns
The count of URL formatted texts. If there is any error, this function will return -1.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
int32 Foxit::PDF::TextPage::GetCharIndexAtPos ( float32  x,
float32  y,
float32  tolerance 
)

Get the character index at or near a specific position in PDF page.

Parameters
[in]xValue of x position in PDF "user space".
[in]yValue of y position in PDF "user space".
[in]toleranceTolerance value for character hit detection, in point units. This should not be a negative.
Returns
The zero-based index of the character at, or nearby point (x,y). Specially, if there are several characters near by point (x, y), the smallest character index will be returned.
If there is no character at or nearby the point, -1 will be returned.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Param means parameter tolerance is negative.
ErrorCode::NotFound means no character is found at the specified position.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
CharInfo ^ Foxit::PDF::TextPage::GetCharInfo ( int32  charIndex)

Get character information of a specific character.

Parameters
[in]charIndexA zero-based index of character. Range: from 0 to (charcount -1). charcount is returned by function TextPage::CountChars.
Returns
A PDF::CharInfo object that receives character information of the specific character.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means parameter charIndex is out of range.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::TextPage::GetChars ( CharRange charRange)

Get text content in current text page, within a specified character range.

Parameters
[in]charRangeCharacter range information. CharRange::Start is a zero-based index of character and from 0 to (charcount -1). charcount is returned by function TextPage::CountChars. Set CharRange::Count to -1 to get the whole characters in the page.
If CharRange::Count is larger than (charcount - CharRange::Start), all the rest character (from CharRange::Start) will be retrieved.
Returns
A String object that receives the text within specified character range.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means parameter start or count is out of range.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::TextPage::GetLink ( int32  linkIndex)

Get the linked URL associated with a specific hyperlink.

Parameters
[in]linkIndexA zero-based index of the specific hyperlink. Range: from 0 to (linkcount - 1). linkcount is returned by function TextPage::CountLinks.
Returns
A String object that receives the hyperlink URL.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means parameter linkIndex is out of range.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
TextSelection ^ Foxit::PDF::TextPage::GetLinkSelection ( int32  linkIndex)

Get a text selection object for a specific hyperlink.

Parameters
[in]linkIndexA zero-based index of the specific hyperlink. Range: from 0 to (linkcount - 1). linkcount is returned by function TextPage::CountLinks.
Returns
A TextSelection object that receives the new PDF text selection obejct if successful.
Application should release this TextSelection object if this object is not in use, by calling function TextSelection::Release.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means parameter linkIndex is out of range.
ErrorCode::Error means the function fails because of any other reasons.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
For more error code values, please refer to enumeration Foxit::ErrorCode.
Boolean Foxit::PDF::TextPage::Release ( )

Release all resources.

Returns
A boolean value: true means success, while false means error.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
TextSelection ^ Foxit::PDF::TextPage::SelectByRange ( CharRange charRange)

Get a text selection object by a specified character range.

Parameters
[in]charRangeCharacter range information. CharRange::Start is a zero-based index of character and from 0 to (charcount -1). charcount is returned by function TextPage::CountChars. Set CharRange::Count to -1 to get the whole characters in the page.
Returns
A TextSelection object that receives a new PDF text selection object if successful.
Application should release this TextSelection object if this object is not in use, by calling function TextSelection::Release.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means parameter start or count is out of range.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
TextSelection ^ Foxit::PDF::TextPage::SelectByRectangle ( RectF rect)

Get a text selection handle by specific rectangle.

Parameters
[in]rectA Foxit::RectF object that specifies rectangle range for selection.
Returns
A TextSelection object that receives a new PDF text selection object if successful.
Application should release this TextSelection object if this object is not in use, by calling function TextSelection::Release.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Param means parameter rect is nullptr.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
TextSearch ^ Foxit::PDF::TextPage::StartSearch ( String^  searchPattern,
uint32  flags,
int32  startIndex 
)

Start a PDF text search process.

This function only starts a search process. Then function TextSearch::FindNext or TextSearch::FindPrev should be called to find the first matched pattern.

Parameters
[in]searchPatternA string to be found.
[in]flagsIndicate the find options. 0 means no special finding options. And it can be one or combination of the following values:
[in]startIndexA zero-based index specifying the character from which the search starts. -1 means from the end of the page.
Range: from -1 to (charcount-1). charcount is returned by function TextPage::CountChars.
Returns
A PDF::TestSearch object to receive a new PDF text search if successful. If no text in the page or there is any error, this function will return nullptr.
Application should release this PDF::TestSearch object if this object is not in use by calling function TextSearch::Release.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Param means parameter searchPattern is nullptr, or parameter flags is illegal.
ErrorCode::NotFound means parameter startIndex is out of range.
ErrorCode::Error means there is no text in the page, or the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.

Foxit Corporation