Skip to main content
Participant
Feb 24, 2020 11:48 PM UTC
Question

Count highlighted words and phrases

Has anyone created an action, similar to the find and highlight, from the masterful Lori Kassuba, to create a count of the number of highlighted words in a document?

 

I need to create a pdf, highlight a set of words/phrases from a list and know how many occurrences, preferably unique (that is to say, the first occurrence of each unique word/phrase highlighted) exist.

 

Failing that, if anyone could point me to a resource for creating the action, that'll work too.

 

Thanks in advance 😉

This topic is closed to new replies. Start a new post to keep the conversation going.

7 replies

Thom Parker
Community Expert
Community Expert
Feb 26, 2020 2:08 AM UTC

If you downloaded that Action from the Actions Exchange at AcrobatUser.com, then I wrote it. The entire action is written in JavaScript, and Lori is not a programmer. 

To get a word count you can simply multiply the number of highlight annotations by the number of words in the search. 

 

Another approach would be to modify this action to keep a running count of the words found.  However, Extracting the script is a bit of a trick. It was writtin for Acrobat X, and will not open in the Actions' editor in Acrobat DC. However, you can get to the script by editing the XML. 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
EX-1Author
Participant
Feb 26, 2020 11:44 AM UTC

Thom,

 

Thanks very much for the insight.  Any thoughts on an efficient way to obtain a count of the first occurrence of each highlight?

Translate
try67
Community Expert
Community Expert
Feb 26, 2020 12:59 PM UTC

Do you want to count the number of occurrences or do you want to know which search terms had a match? Either way, you would need to use a custom-made script to do it.

Translate
try67
Community Expert
Community Expert
Feb 25, 2020 12:15 AM UTC

If the highlights contain the search term as their contents then you could do it with a script that loops over all the comments (annotations) in the file and checks their type and contents properties for unique values.

Translate