I am evaluating your Android PDF Viewer Library to show pdf viewer embedded in the app and need to search functionality. User can search by using keyword and it will show all matched result for all pages in the pdf file. (display all matched result in "ListView") When user clicks the matched result in the row of ListView, it will go to pdf viewer and hilight matched word in the page.
for (int i = 0; i < doc.GetPageCount(); i++)
{
Page page = doc.GetPage(i);
page.ObjsStart();
Finder finder = page.FindOpen(keyword, false, false);
int numMatch = finder.GetCount();
if (numMatch > 0)
{
for (int j = 0; j < numMatch; j++)
{
int startIndex = finder.GetFirstChar(j);
float[] vals = new float[4];
page.ObjsGetCharRect(startIndex, vals);
//I tried to use PDFView.vSetSel() by using the code, but it hilightly position for matched word.
//PDFView.vSetSel(vals[0], vals[1], vals[2], vals[3])
}
}
}
The problem is how do I set hilight color for matched word in the pdf viewer? I tried to use the function "PDFView.vSetSel()" but it does not work. It hilight incorrectly position for matched word. I cannot use "PDFReader.PDFFind" because there may have many matched result in the same page. (For example, I search by using keyword "the", there are 10 matched result in the page 1.)
Could you please provide the example of code that I can use to set hilight color for matched word in the pdf viewer? I cannot find more information from API document and tried to review code from "PDFReaderAct.java" and "PDFReader.java" for 2 - 3 days but I still don't know how to set hilight color for matched word in the pdf viewer.
Thanks for helping