|
Foxit PDF SDK
|
Public 成员函数 | |
| def | FindNext () |
| 搜索下一个匹配的模式。 更多... | |
| def | FindPrev () |
| 搜索上一个匹配的模式。 更多... | |
| def | GetMatchEndCharIndex () |
| 基于当前匹配页面,获取当前匹配模式最后一个字符的索引。 更多... | |
| def | GetMatchPageIndex () |
| 获取当前匹配所属的页面索引。 更多... | |
| def | GetMatchRects () |
| 获取当前匹配模式的矩形。 更多... | |
| def | GetMatchSentence () |
| 获取包含当前匹配模式的句子。 更多... | |
| def | GetMatchSentenceEndIndex () |
| 基于匹配句子,获取当前匹配模式最后一个字符的索引。 更多... | |
| def | GetMatchSentenceStartIndex () |
| 基于匹配句子,获取当前匹配模式第一个字符的索引。 更多... | |
| def | GetMatchStartCharIndex () |
| 基于当前匹配页面,获取当前匹配模式第一个字符的索引。 更多... | |
| def | IsEmpty () |
| 检查当前对象是否为空。 更多... | |
| def | SetEndPage (page_index) |
| 设置结束页面索引。 更多... | |
| def | SetPattern (key_words, is_regex_search) |
| 设置要搜索的关键词。 更多... | |
| def | SetSearchFlags (search_flags) |
| 设置搜索标志。 更多... | |
| def | SetStartCharacter (char_index) |
| 设置起始字符索引,搜索过程从该位置开始。 更多... | |
| def | SetStartPage (page_index) |
| 设置起始页面索引。 更多... | |
此类可以在PDF文档/XFA文档/文本页面或PDF注释的外观中构造文本搜索。 它提供进行文本搜索和获取搜索结果的函数:
要指定搜索模式和选项,请使用函数 fsdk.TextSearch.SetPattern 、 fsdk.TextSearch.SetStartPage 、fsdk.TextSearch.SetEndPage 和 fsdk.TextSearch.SetSearchFlags 。
要进行搜索,请使用函数 fsdk.TextSearch.FindNext 或 fsdk.TextSearch.FindPrev 。
要获取搜索结果,请使用GetMatchXXX()函数。
| def fsdk.TextSearch.FindNext | ( | ) |
搜索下一个匹配的模式。
| def fsdk.TextSearch.FindPrev | ( | ) |
搜索上一个匹配的模式。
| def fsdk.TextSearch.GetMatchEndCharIndex | ( | ) |
基于当前匹配页面,获取当前匹配模式最后一个字符的索引。
| def fsdk.TextSearch.GetMatchPageIndex | ( | ) |
获取当前匹配所属的页面索引。
此函数只能用于PDF文档或XFA文档中的文本搜索。
| def fsdk.TextSearch.GetMatchRects | ( | ) |
获取当前匹配模式的矩形。
| def fsdk.TextSearch.GetMatchSentence | ( | ) |
获取包含当前匹配模式的句子。
| def fsdk.TextSearch.GetMatchSentenceEndIndex | ( | ) |
基于匹配句子,获取当前匹配模式最后一个字符的索引。
在一个句子中,可能有超过2个匹配模式。此函数与函数 一起, 可以帮助确认句子中的哪个模式就是当前匹配的模式。
| def fsdk.TextSearch.GetMatchSentenceStartIndex | ( | ) |
基于匹配句子,获取当前匹配模式第一个字符的索引。
在一个句子中,可能有超过2个匹配模式。此函数与函数 一起, 可以帮助确认句子中的哪个模式就是当前匹配的模式。
| def fsdk.TextSearch.GetMatchStartCharIndex | ( | ) |
基于当前匹配页面,获取当前匹配模式第一个字符的索引。
| def fsdk.TextSearch.IsEmpty | ( | ) |
检查当前对象是否为空。
当前对象为空时,意味着当前对象无用。
| def fsdk.TextSearch.SetEndPage | ( | page_index | ) |
设置结束页面索引。
此函数只能用于使用 PDFDoc 对象或 fsdk.XFADoc 对象 构造的文本搜索对象。对于其他情况,此函数将抛出异常 fsdk.E_ErrUnsupported 。
如果不调用此函数,默认值count-1将用作结束页面索引。
| [in] | page_index | 搜索结束的页面索引。 有效范围:从0到(count-1)。count 由函数 fsdk.PDFDoc.GetPageCount (对于PDF文档)或函数 fsdk.XFADoc.GetPageCount (对于XFA文档)返回。 |
| def fsdk.TextSearch.SetPattern | ( | key_words, | |
| is_regex_search | |||
| ) |
设置要搜索的关键词。
| [in] | key_words | 要搜索的文本内容。它不应是空字符串。 |
| [in] | is_regex_search | true 表示启用正则表达式搜索,false 表示不启用。 如果启用正则表达式搜索,函数 fsdk.TextSearch.SetSearchFlags 设置的搜索标志将被忽略。默认值:false。 |
| def fsdk.TextSearch.SetSearchFlags | ( | search_flags | ) |
设置搜索标志。
如果不调用此函数,将使用默认值 fsdk.TextSearchE_SearchNormal 。
| [in] | search_flags | 搜索标志。请参考从 fsdk.TextSearchE_SearchNormal 开始的值, 这可以是这些值中的一个或组合。 |
| def fsdk.TextSearch.SetStartCharacter | ( | char_index | ) |
设置起始字符索引,搜索过程从该位置开始。
此函数只能用于使用 TextPage 对象或 PDFDoc 对象 构造的文本搜索对象。对于其他情况,此函数将抛出异常 fsdk.E_ErrUnsupported 。
如果不为新构造的文本搜索对象调用此函数, 将使用默认值作为起始字符索引:
对于由函数 fsdk.TextSearch.FindNext 开始的第一次搜索, 将使用0作为起始字符索引。
对于由函数 fsdk.TextSearch.FindPrev 开始的第一次搜索, 将使用(count-1)作为起始字符索引。
| [in] | char_index | 搜索过程开始的起始字符索引。 有效范围:从0到(count-1)。count 表示搜索过程起始页面中的字符数量。 |
| def fsdk.TextSearch.SetStartPage | ( | page_index | ) |
设置起始页面索引。
此函数只能用于使用 PDFDoc 对象或 fsdk.XFADoc 对象 构造的文本搜索对象。对于其他情况,此函数将抛出异常 fsdk.E_ErrUnsupported 。
如果不调用此函数,默认值0将用作起始页面索引。
| [in] | page_index | 搜索开始的页面索引。 有效范围:从0到(count-1)。count 由函数 fsdk.PDFDoc.GetPageCount (对于PDF文档)或函数 fsdk.XFADoc.GetPageCount (对于XFA文档)返回。 |