Skip to main content
Participant
July 6, 2017
Answered

Converted interactive PowerPoint to PDF: JavaScript to change highlight state of all buttons from invert to none?

  • July 6, 2017
  • 1 reply
  • 5063 views

Hi, I have created a PDF from a Microsoft Office PowerPoint presentation, which has multiple action buttons and links. Everything works as it should; however, the default highlight style for each button in Acrobat is 'Invert' which turns the background of the invisible button black on rollover/click. I am able to edit each button individually (changing the highlight style to 'None'); however, there are hundreds of buttons. Therefore, I am hoping that there may be some JavaScript that I can use to achieve this task across the document. Normally, I would take the time and try to figure this out for myself before asking for help but circumstances have conspired against me. Therefore, I would really appreciate it if anyone has a solution.

Many thanks,

Julie

This topic has been closed for replies.
Correct answer try67

This code will edit both links and buttons and set their Highlight property to None:

for (var p=0; p<this.numPages; p++) {

    var box = this.getPageBox("Crop", p);

    var links = this.getLinks(p, box);

    if (links==null || links.length==0) continue;

    for (var i in links) {

        links.highlightMode = "None";

    }

}

for (var i=0; i<this.numFields; i++) {

    var f = this.getField(this.getNthFieldName(i));

    if (f==null) continue;

    if (f.type=="Button");

        f.highlight = highlight.n;

}

If you're interested in an easy way to edit the properties of multiple fields (not links, though) all at once, check out this tool I've developed:

Custom-made Adobe Scripts: Acrobat -- Mass Edit Fields Properties

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 6, 2017

This code will edit both links and buttons and set their Highlight property to None:

for (var p=0; p<this.numPages; p++) {

    var box = this.getPageBox("Crop", p);

    var links = this.getLinks(p, box);

    if (links==null || links.length==0) continue;

    for (var i in links) {

        links.highlightMode = "None";

    }

}

for (var i=0; i<this.numFields; i++) {

    var f = this.getField(this.getNthFieldName(i));

    if (f==null) continue;

    if (f.type=="Button");

        f.highlight = highlight.n;

}

If you're interested in an easy way to edit the properties of multiple fields (not links, though) all at once, check out this tool I've developed:

Custom-made Adobe Scripts: Acrobat -- Mass Edit Fields Properties

juemuseAuthor
Participant
July 6, 2017

Thank you so much for your help. I will check out your custom-made scripts ASAP.