Skip to main content
Participant
November 17, 2016
Question

Highlighted text to bookmark

  • November 17, 2016
  • 3 replies
  • 1299 views

I am trying to automate creating bookmarks from the highlighted text in a document.   We use the Find, Highlight and Extract action on large document files and want to have it also create a bookmarks.  This is the javascript from the action

// Highlight Color

var colHilite = color.yellow;

var oDoc = event.target;

var aAnnts = oDoc.getAnnots({sortBy:"Author"});

for(var i=0;i<aAnnts.length;i++)

{

   if(aAnnts.type == "Redact")

   {

      aAnnts.type = "Highlight";

      aAnnts.strokeColor = colHilite;

   }

}

I have tried to use this and then add some more code for the bookmarks but have failed.  Looking for some help on this. Thanks

This topic has been closed for replies.

3 replies

Joel Geraci
Community Expert
Community Expert
November 17, 2016

Can you elaborate?

I'm guessing you want the bookmark name to match the highlighted text. If that's true, the problem is a bit harder but it's not terrible. If it's not, it's pretty easy.

Participant
November 17, 2016

When we run the Find, Highlight and Extract action it works off the search terms (ie: pizza) and when the page is extracted it highlights the search term.  What I want to do it during this process (or after) is to have acrobat automatically create bookmark from each of the highlighted words or terms.

I don’t care if I can do it during the Find, Highlight and Extract action or if I have to create another action and run it afterwards.

Or simply put, create an action that will bookmark all the highlighted text in a .pdf.

I hope I explained that better.

Joel Geraci
Community Expert
Community Expert
November 17, 2016

Ok - I'm testing my understanding... You might have search terms like "pizza", "calzone", and "stromboli". You want to search for them and highlight them. You also want to create bookmarks. If I were approaching this problem, I'd create a top level bookmark for each search term using the search term as the label. Then create a child bookmark for each page where at least one occurrence of that search term is found and then if there is more than one occurrence, an additional child that goes to the highlight.

Is that what you're thinking?

Also, what if a word gets hyphenated across pages?