text under mouseover

Apr 08, 2020

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.

TOPICS
Acrobat SDK and JavaScript

Views

35

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

text under mouseover

Apr 08, 2020

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.

TOPICS
Acrobat SDK and JavaScript

Views

36

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 08, 2020 0
Apr 08, 2020

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. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 08, 2020 0
Apr 08, 2020

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. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 08, 2020 1