PDF Text

Definitions for access to PDF text operation.
Definitions and functions in this module are included in fpdf_textpage_r.h.
Module: PDFTextPage
License Identifier: PDFTextPage/All
Available License Right: Reading. More...

Classes

struct  FSPDF_TEXTPAGE
 Handle type to PDF text page. More...
 
struct  FSPDF_TEXTSELECTION
 Handle type to PDF text selection. More...
 
struct  FSPDF_TEXTSEARCH
 Handle type to PDF text search. More...
 
struct  FSPDF_TEXTLINK
 Handle type to PDF text link. More...
 
struct  FSPDF_TEXTPAGE_CHARINFO
 Structure for character's information definition. More...
 

Functions

FS_RESULT FSPDF_TextPage_Load (FSCRT_PAGE pdfPage, FSPDF_TEXTPAGE *textPage)
 Prepare information of all characters in a page. More...
 
FS_RESULT FSPDF_TextPage_LoadWithOption (FSCRT_PAGE pdfPage, FS_INT32 option, FSPDF_TEXTPAGE *textPage)
 Prepare information of all characters in a page, with option. More...
 
FS_RESULT FSPDF_TextPage_Release (FSPDF_TEXTPAGE textPage)
 Release all resources allocated for a PDF text page handle. More...
 
FS_RESULT FSPDF_TextPage_CountChars (FSPDF_TEXTPAGE textPage, FS_INT32 *count)
 Get count of characters in a page. More...
 
FS_RESULT FSPDF_TextPage_GetChars (FSPDF_TEXTPAGE textPage, FS_INT32 start, FS_INT32 count, FSCRT_BSTR *chars)
 Get text content in a page, within a specific character range. More...
 
FS_RESULT FSPDF_TextPage_GetUnicode (FSPDF_TEXTPAGE textPage, FS_INT32 index, FS_DWORD *unicode)
 Get the unicode representation of a character in a page. More...
 
FS_RESULT FSPDF_TextPage_ExportToFile (FSPDF_TEXTPAGE textPage, FSCRT_FILE file)
 Export text content in a page to a specific file handle. More...
 
FS_RESULT FSPDF_TextPage_GetCharInfo (FSPDF_TEXTPAGE textPage, FS_INT32 charIndex, FSPDF_TEXTPAGE_CHARINFO *info)
 Get character information of a specific character. More...
 
FS_RESULT FSPDF_TextPage_GetCharIndexAtPos (FSPDF_TEXTPAGE textPage, FS_FLOAT x, FS_FLOAT y, FS_FLOAT tolerance, FS_INT32 *charIndex)
 Get the character index at or around a specific position on the page. More...
 
FS_RESULT FSPDF_TextPage_SelectByRange (FSPDF_TEXTPAGE textPage, FS_INT32 start, FS_INT32 count, FSPDF_TEXTSELECTION *textSelection)
 Get a text selection handle by specific character range. More...
 
FS_RESULT FSPDF_TextPage_SelectByRectangle (FSPDF_TEXTPAGE textPage, const FSCRT_RECTF *rect, FSPDF_TEXTSELECTION *textSelection)
 Get a text selection handle by specific rectangle. More...
 
FS_RESULT FSPDF_TextSelection_Release (FSPDF_TEXTSELECTION textSelection)
 Release all resources allocated for a PDF text selection handle. More...
 
FS_RESULT FSPDF_TextSelection_GetBBox (FSPDF_TEXTSELECTION textSelection, FSCRT_RECTF *bbox)
 Get bounding box(a rectangular area) of a PDF text selected area. More...
 
FS_RESULT FSPDF_TextSelection_GetChars (FSPDF_TEXTSELECTION textSelection, FSCRT_BSTR *chars)
 Extract the whole text from a PDF text selected area. More...
 
FS_RESULT FSPDF_TextSelection_CountPieces (FSPDF_TEXTSELECTION textSelection, FS_INT32 *count)
 Count the number of all rectangular areas of segments in a PDF text selected area. More...
 
FS_RESULT FSPDF_TextSelection_GetPieceRect (FSPDF_TEXTSELECTION textSelection, FS_INT32 pieceIndex, FSCRT_RECTF *rect)
 Get rectangular area of a specific segment, based on the result of the fucntion FSPDF_TextSelection_CountPieces. More...
 
FS_RESULT FSPDF_TextSelection_GetPieceRotation (FSPDF_TEXTSELECTION textSelection, FS_INT32 pieceIndex, FS_INT32 *rotation)
 Get rotation of the specific segment, based on the result returned by function FSPDF_TextSelection_CountPieces. More...
 
FS_RESULT FSPDF_TextSelection_GetPieceCharRange (FSPDF_TEXTSELECTION textSelection, FS_INT32 pieceIndex, FS_INT32 *start, FS_INT32 *count)
 Get index of the start character and the count of characters of a specific segment. More...
 
FS_RESULT FSPDF_TextSelection_GetLayerArray (FSPDF_TEXTSELECTION textSelection, FSPDF_LAYERNODE *layers, FSCRT_ARRAY *layerArray)
 Get the layer array associated with a PDF text selected area. More...
 
FS_RESULT FSPDF_TextSelection_GetVisibleSelection (FSPDF_TEXTSELECTION textSelection, FSPDF_LAYERCONTEXT context, FSPDF_TEXTSELECTION *visibleSelection)
 Get a new PDF text selected area of visible content from a specific a PDF text selected area. More...
 
FS_RESULT FSPDF_TextPage_StartSearch (FSPDF_TEXTPAGE textPage, const FSCRT_BSTR *searchPattern, FS_DWORD flags, FS_INT32 startIndex, FSPDF_TEXTSEARCH *textSearch)
 Start a PDF text search process. More...
 
FS_RESULT FSPDF_TextSearch_Release (FSPDF_TEXTSEARCH textSearch)
 Release all resources allocated for a PDF text search handle. More...
 
FS_RESULT FSPDF_TextSearch_FindNext (FSPDF_TEXTSEARCH textSearch, FS_BOOL *isMatch)
 Search in the direction from start to end of the page. More...
 
FS_RESULT FSPDF_TextSearch_FindPrev (FSPDF_TEXTSEARCH textSearch, FS_BOOL *isMatch)
 Search in the direction from end to start of the page. More...
 
FS_RESULT FSPDF_TextSearch_GetSelection (FSPDF_TEXTSEARCH textSearch, FSPDF_TEXTSELECTION *textSelection)
 Get a text selection handle from a text search when a match is found. More...
 
FS_RESULT FSPDF_TextPage_ExtractLinks (FSPDF_TEXTPAGE textPage, FSPDF_TEXTLINK *textLink)
 Process a PDF page text object to get URL formatted texts (as hyperlinks). More...
 
FS_RESULT FSPDF_TextLink_Release (FSPDF_TEXTLINK textLink)
 Release all resources allocated for a PDF text link handle. More...
 
FS_RESULT FSPDF_TextLink_CountLinks (FSPDF_TEXTLINK textLink, FS_INT32 *linkCount)
 Get count of the URL formatted texts inside a page. More...
 
FS_RESULT FSPDF_TextLink_GetLink (FSPDF_TEXTLINK textLink, FS_INT32 linkIndex, FSCRT_BSTR *linkURI)
 Get the linked URL associated with a specific hyperlink. More...
 
FS_RESULT FSPDF_TextLink_GetSelection (FSPDF_TEXTLINK textLink, FS_INT32 linkIndex, FSPDF_TEXTSELECTION *textSelection)
 Get a PDF text selection handle from a specific hyperlink. More...
 

Macro Definitions for Character State

Note
These are used in function FSPDF_TextPage_GetCharInfo.
#define FSPDF_TEXTPAGE_CHARSTATE_NORMAL   1
 Normal character.
 
#define FSPDF_TEXTPAGE_CHARSTATE_GENERATED   2
 Character is generated by Foxit, such as space character.
 
#define FSPDF_TEXTPAGE_CHARSTATE_NONUNICODE   3
 Character does not have its own unicode value .
 

Macro Definitions for PDF Text Page Parsing Flags

#define FSPDF_TEXT_PARSEOPTION_STREAMORDER   0x0001
 Parse the text content of PDF page by the stream order.
 
#define FSPDF_TEXT_PARSEOPTION_OUTPUTHYPHEN   0x0002
 Parse the text content of PDF page with outputting the hyphen on a line feed.
 

Detailed Description

Definitions for access to PDF text operation.
Definitions and functions in this module are included in fpdf_textpage_r.h.
Module: PDFTextPage
License Identifier: PDFTextPage/All
Available License Right: Reading.

This module contains following features:

Function Documentation

FS_RESULT FSPDF_TextLink_CountLinks ( FSPDF_TEXTLINK  textLink,
FS_INT32 linkCount 
)

Get count of the URL formatted texts inside a page.

Parameters
[in]textLinkHandle to a FSPDF_TEXTLINK object returned by function FSPDF_TextPage_ExtractLinks.
[out]linkCountPointer to a FS_INT32 object that receives the count of links. If there is any error, it will be -1.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textLink or linkCount is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textLink: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextLink_GetLink ( FSPDF_TEXTLINK  textLink,
FS_INT32  linkIndex,
FSCRT_BSTR linkURI 
)

Get the linked URL associated with a specific hyperlink.

Parameters
[in]textLinkHandle to a FSPDF_TEXTLINK object returned by function FSPDF_TextPage_ExtractLinks.
[in]linkIndexA zero-based index of the specific hyperlink. Range: from 0 to (linkcount - 1).linkcount is returned by function FSPDF_TextLink_CountLinks.
[out]linkURIPointer to a FSCRT_BSTR structure that receives the hyperlink URL. It is a UTF-8 string.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textLink or linkURI is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter linkIndex is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot get URL because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe. FSPDF_TextLink_CountLinks should be called first to calculate the count of links.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textLink: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextLink_GetSelection ( FSPDF_TEXTLINK  textLink,
FS_INT32  linkIndex,
FSPDF_TEXTSELECTION *  textSelection 
)

Get a PDF text selection handle from a specific hyperlink.

Parameters
[in]textLinkHandle to a FSPDF_TEXTLINK object returned by function FSPDF_TextPage_ExtractLinks.
[in]linkIndexA zero-based index for the specific hyperlink. Range: from 0 to (linkcount - 1).linkcount is returned by function FSPDF_TextLink_CountLinks.
[out]textSelectionPointer to a FSPDF_TEXTSELECTION handle to receive a new PDF text selection handle if successful.
This handle can be used for PDF text selection related functions.
Application should release this handle if not use by calling function FSPDF_TextSelection_Release.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textLink or textSelection is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter linkIndex is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot get text selection for a link because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textLink: this handle is long-term partially recoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextLink_Release ( FSPDF_TEXTLINK  textLink)

Release all resources allocated for a PDF text link handle.

Parameters
[in]textLinkHandle to a FSPDF_TEXTLINK object returned by function FSPDF_TextPage_ExtractLinks.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textLink is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it for the same objects under multi-threaded environment; otherwise, the application should be synchronized.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • textLink: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_CountChars ( FSPDF_TEXTPAGE  textPage,
FS_INT32 count 
)

Get count of characters in a 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.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[out]countPointer to a FS_INT32 object that receives the count of characters in the page. If an error occurs, this will be set to -1.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage or count is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot get the count of character because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_ExportToFile ( FSPDF_TEXTPAGE  textPage,
FSCRT_FILE  file 
)

Export text content in a page to a specific file handle.

Encode of the text is UTF-8.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[in]fileHandle to a FSCRT_FILE object which can be a file object or memory buffer to export the text.
This can be created by fucntion FSCRT_File_Create or FSCRT_File_CreateFromMemory.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage or file is a NULL pointer.
FSCRT_ERRCODE_FILE if the function cannot access the file handle.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot export text to the file handle because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_ExtractLinks ( FSPDF_TEXTPAGE  textPage,
FSPDF_TEXTLINK *  textLink 
)

Process a PDF page text object to get URL formatted texts (as hyperlinks).

This function must be called before any other hyperlink related functions can be used.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[out]textLinkPointer to a FSPDF_TEXTLINK handle to receive a new PDF text link handle if successful.
Application should release this handle if not use by calling function FSPDF_TextLink_Release.
If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_NOTFOUND if no hyperlink is found in a text page.
FSCRT_ERRCODE_PARAM if parameter textPage or textLink is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if a unrecoverable OOM happens.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot extract hyperlinks in a text page because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • textPage: this handle is long-term partially recoverable.
  • textLink: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_GetCharIndexAtPos ( FSPDF_TEXTPAGE  textPage,
FS_FLOAT  x,
FS_FLOAT  y,
FS_FLOAT  tolerance,
FS_INT32 charIndex 
)

Get the character index at or around a specific position on the page.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[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.
[out]charIndexPointer to a FS_INT32 object that receives 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, this parameter will be set to -1 as a result.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage, or charIndex is a NULL pointer, or parameter tolerance is negative.
FSCRT_ERRCODE_NOTFOUND if no character is found at the specified position.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot get the index of character at or nearby a specific position because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_GetCharInfo ( FSPDF_TEXTPAGE  textPage,
FS_INT32  charIndex,
FSPDF_TEXTPAGE_CHARINFO info 
)

Get character information of a specific character.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[in]charIndexA zero-based index of character. Range: from 0 to (charcount - 1).charcount is returned by function FSPDF_TextPage_CountChars.
[out]infoPointer to a FSPDF_TEXTPAGE_CHARINFO structure that receives character information of the specific character.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage or fontSize is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter charIndex is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot get character information because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_GetChars ( FSPDF_TEXTPAGE  textPage,
FS_INT32  start,
FS_INT32  count,
FSCRT_BSTR chars 
)

Get text content in a page, within a specific character range.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[in]startA zero-based index of character. It'll be the first character in text content. Range: from 0 to (charcount -1). charcount is returned by function FSPDF_TextPage_CountChars.
[in]countCount of characters. -1 means to get the whole characters in the page.
Especially, when parameter count is larger than (charcount - start), all the rest character (from start) will be counted.
[out]charsPointer to a FSCRT_BSTR structure that receives the text string. It is a UTF-8 string.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage or chars is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter start or count is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot retrieve characters because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_GetUnicode ( FSPDF_TEXTPAGE  textPage,
FS_INT32  index,
FS_DWORD unicode 
)

Get the unicode representation of a character in a page.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[in]indexA zero-based index of character. Range: from 0 to (charcount -1). charcount is returned by function FSPDF_TextPage_CountChars.
[out]unicodePointer to a FS_DWORD object to receive the character's unicode, in UTF-32 encoding.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage or unicode is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter index is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot retrieve characters because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_Load ( FSCRT_PAGE  pdfPage,
FSPDF_TEXTPAGE *  textPage 
)

Prepare information of all characters in a page.

Parameters
[in]pdfPageHandle to a valid FSCRT_PAGE object.
[out]textPagePointer to a FSPDF_TEXTPAGE handle to receive a new PDF text page handle if successful.
Application should release this handle if not use it any more by calling function FSPDF_TextPage_Release.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter pdfPage or textPage is a NULL pointer, or parameter flags is invalid.
FSCRT_ERRCODE_INVALIDTYPE if parameter pdfPage is not a type of PDF page.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access to text page is not allowed.
FSCRT_ERRCODE_NOTPARSED if parameter pdfPage is not parsed.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot load text page because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
The application must call function FSPDF_TextPage_Release to release the loaded text page handle.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • pdfPage: this handle is long-term partially recoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_LoadWithOption ( FSCRT_PAGE  pdfPage,
FS_INT32  option,
FSPDF_TEXTPAGE *  textPage 
)

Prepare information of all characters in a page, with option.

Parameters
[in]pdfPageHandle to a valid FSCRT_PAGE object.
[in]optionAn integer value that specifies the parsing option.
Please refer to macro definitions FSPDF_TEXT_PARSEOPTION_XXX and this can be one or a combination of these macros.
If set to 0, this function will be same with function FSPDF_TextPage_Load.
[out]textPagePointer to a FSPDF_TEXTPAGE handle to receive a new PDF text page handle if successful.
Application should release this handle if not use it any more by calling function FSPDF_TextPage_Release.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter pdfPage or textPage is a NULL pointer, or parameter option is invalid.
FSCRT_ERRCODE_INVALIDTYPE if parameter pdfPage is not a type of PDF page.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access to text page is not allowed.
FSCRT_ERRCODE_NOTPARSED if parameter pdfPage is not parsed.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot load text page because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
The application must call function FSPDF_TextPage_Release to release the loaded text page handle.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • pdfPage: this handle is long-term partially recoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_Release ( FSPDF_TEXTPAGE  textPage)

Release all resources allocated for a PDF text page handle.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it for the same objects under multi-threaded environment; otherwise, the application should be synchronized.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_SelectByRange ( FSPDF_TEXTPAGE  textPage,
FS_INT32  start,
FS_INT32  count,
FSPDF_TEXTSELECTION *  textSelection 
)

Get a text selection handle by specific character range.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[in]startA zero-based index of the start character. Range: from 0 to (charcount - 1).charcount is returned by function FSPDF_TextPage_CountChars.
[in]countCount of characters to be extracted. -1 means cover the whole characters in the page.
[out]textSelectionPointer to a FSPDF_TEXTSELECTION handle to receive a new PDF text selection handle if successful.
Application should release this handle if not use by calling function FSPDF_TextSelection_Release.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage or textSelection is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter start or count is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot select text by range because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_SelectByRectangle ( FSPDF_TEXTPAGE  textPage,
const FSCRT_RECTF rect,
FSPDF_TEXTSELECTION *  textSelection 
)

Get a text selection handle by specific rectangle.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned or the parameter FSPDF_TextPage_Load.
[in]rectPointer to a FSCRT_RECTF structure that specifies rectangle range for selection.
[out]textSelectionPointer to a FSPDF_TEXTSELECTION handle to receive a new PDF text selection handle if successful.
Application should release this handle if not use by calling function FSPDF_TextSelection_Release.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage, rect or textSelection is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot select text by rectangle because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textPage: this handle is long-term partially recoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextPage_StartSearch ( FSPDF_TEXTPAGE  textPage,
const FSCRT_BSTR searchPattern,
FS_DWORD  flags,
FS_INT32  startIndex,
FSPDF_TEXTSEARCH *  textSearch 
)

Start a PDF text search process.

This function only starts a search process. Then function FSPDF_TextSearch_FindNext or FSPDF_TextSearch_FindPrev should be called to find the first matched pattern.
If there is no text in the page, this function will return FSCRT_ERRCODE_ERROR.
This function must be called before any other search related functions can be used for the page.

Parameters
[in]textPageHandle to a FSPDF_TEXTPAGE object returned by function FSPDF_TextPage_Load.
[in]searchPatternPointer to a UTF-8 pattern 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 macro definitions:
[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 FSPDF_TextPage_CountChars.
[out]textSearchPointer to a FSPDF_TEXTSEARCH handle to receive a new PDF text search handle if successful.
Application should release this handle if not use by calling function FSPDF_TextSearch_Release.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textPage, searchPattern or textSearch is a NULL pointer, or FSCRT_BSTR::str of searchPattern is NULL, or parameter flags is illegal.
FSCRT_ERRCODE_NOTFOUND if parameter startIndex is out of range. FSCRT_ERRCODE_FORMAT if parameter searchPattern is not a UTF-8 string.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot search text because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • textPage: this handle is long-term partially recoverable.
  • textSearch: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSearch_FindNext ( FSPDF_TEXTSEARCH  textSearch,
FS_BOOL isMatch 
)

Search in the direction from start to end of the page.

Parameters
[in]textSearchHandle to a FSPDF_TEXTSEARCH object returned by function FSPDF_TextPage_StartSearch.
[out]isMatchPointer to a FS_BOOL object that receives a boolean value which indicates whether a match is found or not.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSearch or isMatch is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot find next matched pattern because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSearch: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSearch_FindPrev ( FSPDF_TEXTSEARCH  textSearch,
FS_BOOL isMatch 
)

Search in the direction from end to start of the page.

Parameters
[in]textSearchHandle to a FSPDF_TEXTSEARCH object returned by function FSPDF_TextPage_StartSearch.
[out]isMatchPointer to a FS_BOOL object that receives a boolean value which indicates whether a match is found or not.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSearch or isMatch is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot find previous matched pattern because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSearch: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSearch_GetSelection ( FSPDF_TEXTSEARCH  textSearch,
FSPDF_TEXTSELECTION *  textSelection 
)

Get a text selection handle from a text search when a match is found.

Parameters
[in]textSearchHandle to a FSPDF_TEXTSEARCH object returned by function FSPDF_TextPage_StartSearch.
[out]textSelectionPointer to a FSPDF_TEXTSELECTION handle to receive a new PDF text selection handle if successful.
This handle can be used for PDF text selection related functions.
Application should release this handle if not use by calling function FSPDF_TextSelection_Release.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSearch or textSelection is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot get text selection object for text search result because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSearch: this handle is long-term partially recoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSearch_Release ( FSPDF_TEXTSEARCH  textSearch)

Release all resources allocated for a PDF text search handle.

Parameters
[in]textSearchHandle to a FSPDF_TEXTSEARCH object returned by function FSPDF_TextPage_StartSearch.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSearch is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • textSearch: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_CountPieces ( FSPDF_TEXTSELECTION  textSelection,
FS_INT32 count 
)

Count the number of all rectangular areas of segments in a PDF text selected area.

This function, along with fucntion FSPDF_TextSelection_GetPieceRect, can be used to detect the position of a text segment in a PDF page.
It is the area corresponding to the text segment that is to be highlighted.
It will automatically merge small character boxes into bigger ones if those characters are on the same line with the same font settings.

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
[out]countPointer to a FS_INT32 object that receives the count of segments.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSelection or count is a NULL pointer.
FSCRT_ERRCODE_ERROR if the function cannot get count of selected text pieces because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_GetBBox ( FSPDF_TEXTSELECTION  textSelection,
FSCRT_RECTF bbox 
)

Get bounding box(a rectangular area) of a PDF text selected area.

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

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
[out]bboxPointer to a FSCRT_RECTF structure that receives the 4 boundaries in PDF page space units(left, bottom, right, top) of the bounding box.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSelection or bbox is a NULL pointer.
FSCRT_ERRCODE_ERROR if the function cannot get bounding box of selection area because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_GetChars ( FSPDF_TEXTSELECTION  textSelection,
FSCRT_BSTR chars 
)

Extract the whole text from a PDF text selected area.

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
[out]charsPointer to a FSCRT_BSTR structure that receives the text. It is a UTF-8 string.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSelection or chars is a NULL pointer.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot get characters in selection area because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_GetLayerArray ( FSPDF_TEXTSELECTION  textSelection,
FSPDF_LAYERNODE layers,
FSCRT_ARRAY layerArray 
)

Get the layer array associated with a PDF text selected area.

Content in a PDF text selected area may be in several layers. This function is used to get a layer array which contains these layers.

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
[in]layersPointer to a FSPDF_LAYERNODE structure which will be cleared.
[in,out]layerArrayPointer to a FSCRT_ARRAY structure that receives the layer array.
Please ensure to use function FSCRT_Array_Init (with dataType equals FSCRT_VT_OBJECT_LAYER) to initialize this, and application should call function FSCRT_Array_Clear to release this.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSelection, layers or layerArray is a NULL pointer, or the data type of parameter layerArray is not FSCRT_VT_OBJECT_LAYER.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot get character range of text piece because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSelection: this handle is long-term partially recoverable.
  • layers: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_GetPieceCharRange ( FSPDF_TEXTSELECTION  textSelection,
FS_INT32  pieceIndex,
FS_INT32 start,
FS_INT32 count 
)

Get index of the start character and the count of characters of a specific segment.

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
[in]pieceIndexA zero-based index of the segment, of which the character range is to be got.
Range: from 0 to (segmentcount - 1).segmentcount is returned by function FSPDF_TextSelection_CountPieces.
[out]startPointer to a FS_INT32 object that receives the index of start character of the segment. -1 means error.
[out]countPointer to a FS_INT32 object that receives the count of characters in the segment. -1 means error.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSelection, start or count is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter pieceIndex is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot get character range of text piece because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_GetPieceRect ( FSPDF_TEXTSELECTION  textSelection,
FS_INT32  pieceIndex,
FSCRT_RECTF rect 
)

Get rectangular area of a specific segment, based on the result of the fucntion FSPDF_TextSelection_CountPieces.

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
[in]pieceIndexA zero-based index of the segment. Range: from 0 to (segmentcount - 1).segmentcount is returned by function FSPDF_TextSelection_CountPieces.
[out]rectPointer to a FSCRT_RECTF structure that receives the 4 boundaries(left, top, right, bottom) of rectangle area.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSelection or rect is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter pieceIndex is out of range.
FSCRT_ERRCODE_ERROR if the function cannot get rectangle of text piece because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_GetPieceRotation ( FSPDF_TEXTSELECTION  textSelection,
FS_INT32  pieceIndex,
FS_INT32 rotation 
)

Get rotation of the specific segment, based on the result returned by function FSPDF_TextSelection_CountPieces.

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

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
[in]pieceIndexA zero-based index of the rotation segment. Range: from 0 to (segmentcount - 1).segmentcount is returned by function FSPDF_TextSelection_CountPieces.
[out]rotationPointer to a FS_INT32 object that receives the rotation for the text on the specific page rect.
Range: 0 to 359 in clockwise. And -1 means failure.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSelection or rotation is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if parameter pieceIndex is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function can not be recovered.
FSCRT_ERRCODE_ERROR if the function cannot get rotation value of text piece because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_GetVisibleSelection ( FSPDF_TEXTSELECTION  textSelection,
FSPDF_LAYERCONTEXT  context,
FSPDF_TEXTSELECTION *  visibleSelection 
)

Get a new PDF text selected area of visible content from a specific a PDF text selected area.

Content in a PDF text selected area may be in several layers. Whether the content is visible depends on the visibility of the layer that the content belongs to. If user just wants to get the visible content, this function can be used.

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
[in]contextHandle to a FSPDF_LAYERCONTEXT object which is PDF layer context.
[out]visibleSelectionPointer to a FSPDF_TEXTSELECTION object that receives the new selected area.
Application should call function FSPDF_TextSelection_Release to release this.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter context, layer or visibleis NULL.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe. OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • context: this handle is long-term partially recoverable.
  • layer: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_TextSelection_Release ( FSPDF_TEXTSELECTION  textSelection)

Release all resources allocated for a PDF text selection handle.

Parameters
[in]textSelectionHandle to a FSPDF_TEXTSELECTION object to be released. It can be returned by function FSPDF_TextPage_SelectByRange, FSPDF_TextPage_SelectByRectangle, FSPDF_TextSearch_GetSelection, or FSPDF_TextLink_GetSelection.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter textSelection is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it for the same objects under multi-threaded environment; otherwise, the application should be synchronized.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • textSelection: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.

Foxit Corporation