• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

text under mouseover

New Here ,
Apr 08, 2020 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

202

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
community guidelines
Community Expert ,
Apr 08, 2020 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. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
community guidelines
LEGEND ,
Apr 08, 2020 Apr 08, 2020

Copy link to clipboard

Copied

LATEST

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. 

Votes

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
community guidelines