Foxit::PDF::TextSelection Class Reference

Class to represent text selection. More...

Public Member Functions

Boolean Release ()
 Release all resources. More...
 
RectFGetBBox ()
 Get bounding box (a rectangular area) of current PDF text selection object. More...
 
String^ GetChars ()
 Extract the whole text from current PDF text selection object. More...
 
int32 CountPieces ()
 Count the number of all rectangular areas of segments in current PDF text selection object. More...
 
RectFGetPieceRect (int32 pieceIndex)
 Get rectangular area of a specified segment, based on the result of function TextSelection::CountPieces. More...
 
int32 GetPieceRotation (int32 pieceIndex)
 Get rotation of the specific segment, based on the result returned by function TextSelection::CountPieces. More...
 
CharRangeGetPieceCharRange (int32 pieceIndex)
 Get the character range of a specified segment. More...
 

Properties

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

Detailed Description

Class to represent text selection.

Text selection represents a selected area of text, which is commonly expressed as a sequential text data. Following functions can be called to retrieve a text selection object:

Member Function Documentation

int32 Foxit::PDF::TextSelection::CountPieces ( )

Count the number of all rectangular areas of segments in current PDF text selection object.

This function, along with function TextSelection::GetPieceRect, can be used to detect the position of a text segment in a PDF page.
It will automatically merge small character boxes into bigger ones if those characters are on the same line and have same font settings.

Returns
The count of segments.
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.
RectF ^ Foxit::PDF::TextSelection::GetBBox ( )

Get bounding box (a rectangular area) of current PDF text selection object.

Bounding box is the smallest rectangle to enclose the entire selected chars.

Returns
A Foxit::RectF object that receives the 4 boundaries in PDF page space units(left, bottom, right, top) of the bounding box.
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.
String ^ Foxit::PDF::TextSelection::GetChars ( )

Extract the whole text from current PDF text selection object.

Returns
A String object that receives the text contained in current PDF text selection object.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
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.
CharRange ^ Foxit::PDF::TextSelection::GetPieceCharRange ( int32  pieceIndex)

Get the character range of a specified segment.

A character range information contains the index of the start character and the count of characters in the segment.

Parameters
[in]pieceIndexA zero-based index of the segment. Range: from 0 to (segmentcount - 1). segmentcount is returned by function TextSelection::CountPieces.
Returns
A PDF::CharRange object that receives character range information.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means parameter pieceIndex 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.
RectF ^ Foxit::PDF::TextSelection::GetPieceRect ( int32  pieceIndex)

Get rectangular area of a specified segment, based on the result of function TextSelection::CountPieces.

Parameters
[in]pieceIndexA zero-based index of the segment. Range: from 0 to (segmentcount - 1). segmentcount is returned by function TextSelection::CountPieces.
Returns
A Foxit::RectF object that receives the 4 boundaries(left, top, right, bottom) of rectangle area.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means parameter pieceIndex 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.
int32 Foxit::PDF::TextSelection::GetPieceRotation ( int32  pieceIndex)

Get rotation of the specific segment, based on the result returned by function TextSelection::CountPieces.

Rotation value of text means how many degrees it costs to rotate the text in clockwise from horizontal direction.

Parameters
[in]pieceIndexA zero-based index of the segment. Range: from 0 to (segmentcount - 1). segmentcount is returned by function TextSelection::CountPieces.
Returns
The rotation value. Range: 0 to 359 in clockwise. 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::NotFound means parameter pieceIndex is out of range.
ErrorCode::Error means the function cannot get rotation value of text piece because of any other reason.
For more error code values, please refer to enumeration Foxit::ErrorCode.
Boolean Foxit::PDF::TextSelection::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.

Foxit Corporation