Skip to main content
Known Participant
July 23, 2017
Question

How to batch underline all text in all pdf files in a folder ?

  • July 23, 2017
  • 2 replies
  • 3893 views

How to batch underline all text in all pdf files in a folder with acrobat DC pro ?

[Moved from the Adobe Acrobat Reader forum to Editing & Exporting PDFs by moderator.]

.

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
July 23, 2017

​All ​the text in ​all​ the files? What for?

Known Participant
July 29, 2017

Only want to underline or strike through searched text in files. I found a code online but its on color highlighting.

I am looking for something similar to this:i

// I copied it from somewhere online

// 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;

   }

}

try67
Community Expert
Community Expert
July 29, 2017

I still don't understand why you would want to do it, but you can use this script:

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

    var numWords = this.getPageNumWords(p);

    for (var i=0; i<numWords; i++) {

        var wordQuads = this.getPageNthWordQuads(p,i);

        this.addAnnot({page: p, type: "Underline", quads: wordQuads});

    }

}

Bernd Alheit
Community Expert
Community Expert
July 23, 2017

Try a forum for Adobe Acrobat.