Copy link to clipboard
Copied
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.
1 Correct answer
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
...Copy link to clipboard
Copied
I'm working with Acrobat pro 2022.003.20258
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks so much. Will give it a crack myself first, but if not will seek some funding for your tool.

