Foxit PDF SDK
|
Public Member Functions | |
def | TextSearch (document, cancel, flags) |
Constructor, for a PDF document. More... | |
def | FindNext () |
Search for next matched pattern. More... | |
def | FindPrev () |
Search for previous matched pattern. More... | |
def | GetMatchEndCharIndex () |
Get the index of the last character of current match pattern, based on current match page. More... | |
def | GetMatchPageIndex () |
Get the page index, to which current match belongs. More... | |
def | GetMatchRects () |
Get the rectangles of current match pattern. More... | |
def | GetMatchSentence () |
Get the sentence that contains current match pattern. More... | |
def | GetMatchSentenceEndIndex () |
Get the index of the last character of current matched pattern, based on the matched sentence. More... | |
def | GetMatchSentenceStartIndex () |
Get the index of the first character of current matched pattern, based on the matched sentence. More... | |
def | GetMatchStartCharIndex () |
Get the index of the first character of current match pattern, based on current match page. More... | |
def | IsEmpty () |
Check whether current object is empty or not. More... | |
def | SetEndPage (page_index) |
Set ending page index. More... | |
def | SetPattern (key_words) |
Set keywords to search. More... | |
def | SetSearchFlags (search_flags) |
Set search flags. More... | |
def | SetStartCharacter (char_index) |
Set starting character index, from where the search process is to be started. More... | |
def | SetStartPage (page_index) |
Set starting page index. More... | |
Static Public Attributes | |
e_SearchConsecutive = _fsdk.TextSearch_e_SearchConsecutive | |
If set, match the key word consecutively when searching. For example, "CC" will be matched twice in "CCC". | |
e_SearchMatchCase = _fsdk.TextSearch_e_SearchMatchCase | |
If set, match the case of keyword when searching. | |
e_SearchMatchWholeWord = _fsdk.TextSearch_e_SearchMatchWholeWord | |
If set, match the whole word of keyword when searching. | |
e_SearchNormal = _fsdk.TextSearch_e_SearchNormal | |
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 FoxitPDFSDKPython2.TextSearch.SetPattern , FoxitPDFSDKPython2.TextSearch.SetStartPage , FoxitPDFSDKPython2.TextSearch.SetEndPage and FoxitPDFSDKPython2.TextSearch.SetSearchFlags .
To do the searching, use function FoxitPDFSDKPython2.TextSearch.FindNext or FoxitPDFSDKPython2.TextSearch.FindPrev .
To get the searching result, use functions GetMatchXXX().
def FoxitPDFSDKPython2.TextSearch.TextSearch | ( | document, | |
cancel, | |||
flags | |||
) |
Constructor, for a PDF document.
Constructor, with another text search object.
Constructor, for a specified PDF annotation.
Constructor, for a specified text page.
Constructor, for a specified XFA 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.
[in] | document | A valid PDF document object. |
[in] | 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. Default value: null. |
[in] | flags | Parsing flags used for parsing text during searching. Please refer to values starting from FoxitPDFSDKPython2.TextPage.e_ParseTextNormal and this can be one or combination of these values. |
[in] | xfa_document | A valid XFA document object. It should have been loaded by function FoxitPDFSDKPython2.XFADoc.StartLoad . |
[in] | 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. Default value: null. |
[in] | text_page | A text page object. |
Currently, only support to search in appearance of following annotation types: freetext annotation, stamp annotation, widget annotation, and line annotation.
[in] | annot | A valid annotation object. |
[in] | other | Another text search object. |
def FoxitPDFSDKPython2.TextSearch.FindNext | ( | ) |
Search for next matched pattern.
def FoxitPDFSDKPython2.TextSearch.FindPrev | ( | ) |
Search for previous matched pattern.
def FoxitPDFSDKPython2.TextSearch.GetMatchEndCharIndex | ( | ) |
Get the index of the last character of current match pattern, based on current match page.
def FoxitPDFSDKPython2.TextSearch.GetMatchPageIndex | ( | ) |
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.
def FoxitPDFSDKPython2.TextSearch.GetMatchRects | ( | ) |
Get the rectangles of current match pattern.
def FoxitPDFSDKPython2.TextSearch.GetMatchSentence | ( | ) |
Get the sentence that contains current match pattern.
def FoxitPDFSDKPython2.TextSearch.GetMatchSentenceEndIndex | ( | ) |
Get the index of the last character of current matched pattern, based on the matched sentence.
In a sentence, there may be more than 2 matched patterns. This function, along with function , can help to confirm which pattern in the sentence is just current matched pattern.
def FoxitPDFSDKPython2.TextSearch.GetMatchSentenceStartIndex | ( | ) |
Get the index of the first character of current matched pattern, based on the matched sentence.
In a sentence, there may be more than 2 matched patterns. This function, along with function , can help to confirm which pattern in the sentence is just current matched pattern.
def FoxitPDFSDKPython2.TextSearch.GetMatchStartCharIndex | ( | ) |
Get the index of the first character of current match pattern, based on current match page.
def FoxitPDFSDKPython2.TextSearch.IsEmpty | ( | ) |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
def FoxitPDFSDKPython2.TextSearch.SetEndPage | ( | page_index | ) |
Set ending page index.
This function can only be used for a text search object which is constructed with PDFDoc object or FoxitPDFSDKPython2.XFADoc object. For other case, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .
If this function is not called, default value count-1 will be used as the ending page index.
[in] | page_index | Index of the page, from which the search ended. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython2.PDFDoc.GetPageCount for PDF document or by function FoxitPDFSDKPython2.XFADoc.GetPageCount for XFA document. |
def FoxitPDFSDKPython2.TextSearch.SetPattern | ( | key_words | ) |
Set keywords to search.
[in] | key_words | The text content to be searched. It should not be an empty string. |
def FoxitPDFSDKPython2.TextSearch.SetSearchFlags | ( | search_flags | ) |
Set search flags.
If this function is not called, default value FoxitPDFSDKPython2.TextSearch.e_SearchNormal will be used.
[in] | search_flags | Search flags. Please refer to values starting from FoxitPDFSDKPython2.TextSearch.e_SearchNormal and this can be one or combination of these values. |
def FoxitPDFSDKPython2.TextSearch.SetStartCharacter | ( | char_index | ) |
Set starting character index, from where the search process is to be started.
This function can only be used for a text search object which is constructed with TextPage object or PDFDoc object. For other case, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .
If this function is not called for a newly constructed text serach object, default value will be used as the starting character index:
0 will be used as the starting character index for first search started by functionFoxitPDFSDKPython2.TextSearch.FindNext .
(count-1) will be used as the starting character index for first search by function FoxitPDFSDKPython2.TextSearch.FindPrev .
[in] | char_index | Starting character index, from where the search process is to be started. Valid range: from 0 to (count-1). count means the count of characters in the starting page for search process. |
def FoxitPDFSDKPython2.TextSearch.SetStartPage | ( | page_index | ) |
Set starting page index.
This function can only be used for a text search object which is constructed with PDFDoc object or FoxitPDFSDKPython2.XFADoc object. For other case, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .
If this function is not called, default value 0 will be used as the starting page index.
[in] | page_index | Index of the page, from which the search starts. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython2.PDFDoc.GetPageCount for PDF document or by function FoxitPDFSDKPython2.XFADoc.GetPageCount for XFA document. |