TextHighlightAnnotation

I am trying to highlight a numeric value from a PDF file when mouse over, but since I have to retrieve the page text and find the indexOf that search term I am looking for it only highlights the first match it finds in taht array. So if value is repeated in that page it will only highlight the first one, even if I am mouse over on the second one.

Hi Daniel,

What PDFNet product are you using? WebViewer, Windows, Linux, etc.

If you are using Javascript, you can use the indexOf function to find all indices. You can loop, always increasing the second parameter till you hit a result of -1.

Let me know if this works for you and if you have any other questions.

Imagine I have a page where the text “2022” appears three times. I am trying to highlight that text when mouse over, by retrieving the page text and looking into the indexOf that search term I can only access to the first place where “2022” appears instead of the current one I am mouse overing.

Is there any solution to that specific case?

By using a loop and indexOf, you can find all instances of “2022” rather than just the first one. If you wish to specifically find text that you are mousing, then you must use some other method to search.

Can you recommend what other method should I use to search? I can’t find any by reading your docs that returns me the needed QUADS to send to the TextHighlightAnnotation in order to highlight that value.