Copy link to clipboard
Copied
Is there an efficient way of getting the word under the mouse using the Acrobat SDK? I have seen some discussion of using AVPageViewDevicePointToPage, enumerating the text elements, then doing a hit test using PDEElementIsAtPoint. Of course, this is probably not so efficient. Any tips much appreciated. I would like to make a simple dictionary lookup tool that responds as you move the mouse.
Copy link to clipboard
Copied
I've wrote exactly that code almost 20 years ago. It don't think I'd call it efficient. It was a pain to write, but it's more than fast enough to walk the page content looking for words. Its much easier to use the wordfinder since the code doesn't have to push into xObjects and compensate for the local content matrix.
Copy link to clipboard
Copied
Another way is to create a word finder for the current page. You can go though the list of words and compare quads to see which word is at a point. This is preferable to using PDEElement since a word may be many elements. To optimise you need only make the word finder once per page, and you can experiment with alogorithms to make optimised indexes to the quad list.