Knowledge Base - Search in whole pdf file (Android)

This article shows how to search a string in a whole pdf file.

With this method you can use a Document instance to search a word in a whole pdf file and store/menage results.

public void customSearch(Document doc, String search){

boolean caseSensitive = false;
boolean wholeWord = false;

for (int i = 0; i < doc.GetPageCount(); i++) {

// get page
Page page = doc.GetPage(i);
page.ObjsStart();

// find in page
Page.Finder finder = page.FindOpen(search, caseSensitive, wholeWord);

// manage each search term contained in this page
for (int c = 0; c < finder.GetCount(); c++) {

// start position
int firstCharPos = finder.GetFirstChar(c);

Log.w("---search---", "Page " + i);
Log.w("---search---", "Pos : " + firstCharPos);

// do custom actions

}

// close page
page.Close();
}

}
Applies To

RadaeePDF SDK for Android

Details

Created : 2018-01-18 14:17:09, Last Modified : 2018-01-18 14:42:41