I use the TextSearch class to find matches within a PDF file. How can I display the sentences that contains the keyword. In another word, I need to show up the Text the in before or after the keyword. anyway I could do it ? Also, is there any way that I could listen to it that search to which pages? or I could stop it in the middle?
For the first question, you can use TextSearchResult.getAmbientStr(). For the second one, please have a look at this example http://www.pdftron.com/pdfnet/samplecode/TextSearchTest.java Roughly speaking, you can use TextSearch.e_page_stop in the search mode. This will inform TextSearch.run() to return at the end of each page (regardless if there is anything found). Then you can check for result.getCode() == TextSearchResult.e_page.