Count highlighted words and phrases

New Here ,
Feb 24, 2020 Feb 24, 2020

Copy link to clipboard

Copied

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 😉

TOPICS
Acrobat SDK and JavaScript, Comment review and collaborate PDF

Views

219

Likes

translate

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Feb 24, 2020 Feb 24, 2020

Copy link to clipboard

Copied

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.

Likes

translate

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

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. 

 

Likes

translate

Translate

Translate

Report

Report
Reply
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 ,
Feb 26, 2020 Feb 26, 2020

Copy link to clipboard

Copied

Thom,

 

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

Likes

translate

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Feb 26, 2020 Feb 26, 2020

Copy link to clipboard

Copied

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.

Likes

translate

Translate

Translate

Report

Report
Reply
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 ,
Feb 26, 2020 Feb 26, 2020

Copy link to clipboard

Copied

Thanks for the question.  Actually, I just need the count per search term; that'll give me both data sets.

Likes

translate

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 28, 2020 Feb 28, 2020

Copy link to clipboard

Copied

To create a solution you need to either 

1) find something unique about the highlights that a script can detect, so they can be counted,

You can obtains a list of all annotations on the PDF with 

var aAnnots = this.getAnnots();

 

This list can then be filtered for specific characteristics, which will give you the count. 

The trick is determining the criteria for filtering.

 

2) modify the existing script to add in the counting feature you want. 

 

I would be happy to do this for a fee.  Contact me through www.windjack.com

 

 

Likes

translate

Translate

Translate

Report

Report
Reply
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 ,
Feb 28, 2020 Feb 28, 2020

Copy link to clipboard

Copied

Thom,

 

That's really helpful!  Let me give that try and I'll get back to you.

Many thanks for your time and insight.

Likes

translate

Translate

Translate

Report

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