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

Automatically search PDF and add tooltips to key text

New Here ,
Jan 23, 2023 Jan 23, 2023

I want to check if what I am after is even possible. In short, I want to create a local JSON file that is essentially a dictionary that takes a word and the assoiated definition (eg: {word1 : definition, word2 : definition...}

 

Then I want to be able to scan a PDF and automatically create a form for each keyword that is a tooltip/popup with the definition. 

 

Very new to Acrobat, so am struggling to know where to start (or if it is even possible?). I'm assuming a document level JS that reads in the JSON file, but not sure how to automatically/dynamically create tooltips.

TOPICS
Acrobat SDK and JavaScript , Windows
721
Translate
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

correct answers 1 Correct answer

Community Expert , Jan 23, 2023 Jan 23, 2023

Yes, that will work. Basically, you would need to use a loop to search all the words in all the pages of the file (using getPageNthWord and getPageNumWords) to look for matches for the items in the list (which you can read using readFileIntoStream of the util object), and then add a (transparent) button over each one with the tooltip text (using addField).

This is not a trivial task, though, especially if the search terms are more than one word, and/or the file is very long, as I've said earlier

...
Translate
New Here ,
Jan 23, 2023 Jan 23, 2023

I'm working with Acrobat pro 2022.003.20258

Translate
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 ,
Jan 23, 2023 Jan 23, 2023

Yes, this is possible, but in order to read the contents of an external file automatically (without selecting it each time) a script file will have to be installed on each computer where this should work. Is that possible in your case?

Also, this might seriously slow down the process of opening the file, depending on how long it is, and how long (and complex) the list of search terms are.

Translate
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
New Here ,
Jan 23, 2023 Jan 23, 2023

Thanks! So I would only need to run this on my own machine, and then share the output PDF (ie: after the tooltips have been added) with others who only have acrobat reader (not pro); I'm guessing this still OK? Could you point me in the direction of where to start? Or some related threads? I didn't have much luck when I searched the forum. 

Translate
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 ,
Jan 23, 2023 Jan 23, 2023

Yes, that will work. Basically, you would need to use a loop to search all the words in all the pages of the file (using getPageNthWord and getPageNumWords) to look for matches for the items in the list (which you can read using readFileIntoStream of the util object), and then add a (transparent) button over each one with the tooltip text (using addField).

This is not a trivial task, though, especially if the search terms are more than one word, and/or the file is very long, as I've said earlier.

 

I've actually developed a (paid-for) tool that does exactly that: https://www.try67.com/tool/acrobat-add-tooltip-text-to-key-words-or-phrases

 

Translate
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
New Here ,
Jan 23, 2023 Jan 23, 2023
LATEST

Thanks so much. Will give it a crack myself first, but if not will seek some funding for your tool.

Translate
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