Public Member Functions | |
TextSearch (PDFDoc document, SearchCancelCallback cancel) throws com.foxit.sdk.PDFException | |
Constructor, for a PDF document. More... | |
TextSearch (XFADoc xfa_document, SearchCancelCallback cancel) throws com.foxit.sdk.PDFException | |
Constructor, for a specified XFA document. More... | |
TextSearch (TextPage text_page) throws com.foxit.sdk.PDFException | |
Constructor, for a specified text page. More... | |
TextSearch (Annot annot) throws com.foxit.sdk.PDFException | |
Constructor, for a specified PDF annotation. More... | |
TextSearch (TextSearch other) | |
Constructor, with another TextSearch object. More... | |
boolean | findNext () throws com.foxit.sdk.PDFException |
Search for next matched pattern. More... | |
boolean | findPrev () throws com.foxit.sdk.PDFException |
Search for previous matched pattern. More... | |
int | getMatchEndCharIndex () throws com.foxit.sdk.PDFException |
Get the index of the last character of current match pattern, based on current match page. More... | |
int | getMatchPageIndex () throws com.foxit.sdk.PDFException |
Get the page index, to which current match belongs. More... | |
RectFArray | getMatchRects () throws com.foxit.sdk.PDFException |
Get the rectangles of current match pattern. More... | |
String | getMatchSentence () throws com.foxit.sdk.PDFException |
Get the sentence that contains current match pattern. More... | |
int | getMatchSentenceStartIndex () throws com.foxit.sdk.PDFException |
Get the index of the first character of current match pattern, based on the match sentence. More... | |
int | getMatchStartCharIndex () throws com.foxit.sdk.PDFException |
Get the index of the first character of current match pattern, based on current match page. More... | |
boolean | isEmpty () |
Check whether current object is empty or not. More... | |
boolean | setEndPage (int page_index) throws com.foxit.sdk.PDFException |
Set ending page index. More... | |
boolean | setPattern (String key_words) throws com.foxit.sdk.PDFException |
Set keywords to search. More... | |
boolean | setSearchFlags (int search_flags) throws com.foxit.sdk.PDFException |
Set search flags. More... | |
boolean | setStartPage (int page_index) throws com.foxit.sdk.PDFException |
Set starting page index. More... | |
Static Public Attributes | |
static final int | e_SearchConsecutive = 0x04 |
If set, match the key word consecutively when searching. For example, "CC" will be matched twice in "CCC". | |
static final int | e_SearchMatchCase = 0x01 |
If set, match the case of keyword when searching. | |
static final int | e_SearchMatchWholeWord = 0x02 |
If set, match the whole word of keyword when searching. | |
static final int | e_SearchNormal = 0x00 |
No special searching options. | |
This class can construct text search in a PDF document/an XFA document/a text page or in a PDF annotation's appearance. It offers functions to do a text search and get the searching result:
To specify the searching pattern and options, use functions TextSearch::setPattern, TextSearch::setStartPage (only useful for a text search in PDF document), TextSearch::setEndPage (only useful for a text search in PDF document) and TextSearch::setSearchFlags.
To do the searching, use function TextSearch::findNext or TextSearch::findPrev.
To get the searching result, use functions GetMatchXXX().
com.foxit.sdk.pdf.TextSearch.TextSearch | ( | PDFDoc | document, |
SearchCancelCallback | cancel | ||
) | throws com.foxit.sdk.PDFException |
Constructor, for a PDF document.
User can set a valid SearchCancelCallback object in order to decide whether to cancel the searching process or not when the callback function in SearchCancelCallback is triggered.
document | A valid PDF document object. |
cancel | A SearchCancelCallback object which decides if the searching process needs to be canceled when the callback function is triggered. This can be null which means not to cancel the searching process. If this is not null, it should be a valid SearchCancelCallback object implemented by user. |
com.foxit.sdk.pdf.TextSearch.TextSearch | ( | XFADoc | xfa_document, |
SearchCancelCallback | cancel | ||
) | throws com.foxit.sdk.PDFException |
Constructor, for a specified XFA document.
xfa_document | A valid XFA document object. It should have been loaded by function addon::xfa::XFADoc::startLoad. |
cancel | A SearchCancelCallback object which decides if the searching process needs to be canceled when the callback function is triggered. This can be null which means not to cancel the searching process. If this is not null, it should be a valid SearchCancelCallback object implemented by user. |
com.foxit.sdk.pdf.TextSearch.TextSearch | ( | TextPage | text_page | ) | throws com.foxit.sdk.PDFException |
Constructor, for a specified text page.
text_page | A text page object. |
com.foxit.sdk.pdf.TextSearch.TextSearch | ( | Annot | annot | ) | throws com.foxit.sdk.PDFException |
Constructor, for a specified PDF annotation.
Currently, only support to search in appearance of following annotation types: free text annotation, stamp annotation, widget annotation, stamp annotation, and line annotation.
annot | A valid annotation object. |
com.foxit.sdk.pdf.TextSearch.TextSearch | ( | TextSearch | other | ) |
Constructor, with another TextSearch object.
other | Another TextSearch object. |
boolean com.foxit.sdk.pdf.TextSearch.findNext | ( | ) | throws com.foxit.sdk.PDFException |
Search for next matched pattern.
boolean com.foxit.sdk.pdf.TextSearch.findPrev | ( | ) | throws com.foxit.sdk.PDFException |
Search for previous matched pattern.
int com.foxit.sdk.pdf.TextSearch.getMatchEndCharIndex | ( | ) | throws com.foxit.sdk.PDFException |
Get the index of the last character of current match pattern, based on current match page.
int com.foxit.sdk.pdf.TextSearch.getMatchPageIndex | ( | ) | throws com.foxit.sdk.PDFException |
Get the page index, to which current match belongs.
This function can only be used for a text search in PDF document or in XFA document.
RectFArray com.foxit.sdk.pdf.TextSearch.getMatchRects | ( | ) | throws com.foxit.sdk.PDFException |
Get the rectangles of current match pattern.
String com.foxit.sdk.pdf.TextSearch.getMatchSentence | ( | ) | throws com.foxit.sdk.PDFException |
Get the sentence that contains current match pattern.
int com.foxit.sdk.pdf.TextSearch.getMatchSentenceStartIndex | ( | ) | throws com.foxit.sdk.PDFException |
Get the index of the first character of current match pattern, based on the match sentence.
In a sentence, there may be more than 2 match patterns. This function can help to confirm which pattern in the sentence is just current match pattern.
int com.foxit.sdk.pdf.TextSearch.getMatchStartCharIndex | ( | ) | throws com.foxit.sdk.PDFException |
Get the index of the first character of current match pattern, based on current match page.
boolean com.foxit.sdk.pdf.TextSearch.isEmpty | ( | ) |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
boolean com.foxit.sdk.pdf.TextSearch.setEndPage | ( | int | page_index | ) | throws com.foxit.sdk.PDFException |
Set ending page index.
This function can only be used for a text search in PDF document or in XFA document. For other case, this function will throw exception e_ErrUnsupported.
If this function is not called, default value count-1 will be used as the ending page index.
page_index | Index of the page, from which the search ended. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::getPageCount for PDF document or by function addon::xfa::XFADoc::getPageCount for XFA document. |
boolean com.foxit.sdk.pdf.TextSearch.setPattern | ( | String | key_words | ) | throws com.foxit.sdk.PDFException |
Set keywords to search.
key_words | The text content to be searched. It should not be an empty string. |
boolean com.foxit.sdk.pdf.TextSearch.setSearchFlags | ( | int | search_flags | ) | throws com.foxit.sdk.PDFException |
Set search flags.
If this function is not called, default value e_SearchNormal will be used.
search_flags | Search flags. Please refer to values starting from e_SearchNormal and this can be one or combination of these values. |
boolean com.foxit.sdk.pdf.TextSearch.setStartPage | ( | int | page_index | ) | throws com.foxit.sdk.PDFException |
Set starting page index.
This function can only be used for a text search in PDF document or in XFA document. For other case, this function will throw exception e_ErrUnsupported.
If this function is not called, default value 0 will be used as the starting page index.
page_index | Index of the page, from which the search starts. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::getPageCount for PDF document or by function addon::xfa::XFADoc::getPageCount for XFA document. |