【Foxit PDF SDK】福昕GSDK如何检索匹配用户提供的关键字?

您可以参考以下示例代码:

TextSearch search = new TextSearch(doc, null, TextPage.e_ParseTextNormal );

int start_index = 0, end_index = doc.getPageCount() – 1;

search.setStartPage(0);

search.setEndPage(doc.getPageCount() – 1);

String pattern = "Foxit";

search.setPattern(pattern);

int flags = e_SearchNormal;

// if want to specify flags, you can do it like this:

// flags |= TextSearch::e_SearchMatchCase;

// flags |= TextSearch::e_SearchMatchWholeWord;

// flags |= TextSearch::e_SearchConsecutive;

search.setSearchFlags(flags);

int match_count = 0;

while (search.findNext()) {

RectFArray rect_array = search.getMatchRects();

match_count++;

}