Copy link to clipboard
Copied
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.]
.
Copy link to clipboard
Copied
Try a forum for Adobe Acrobat.
Copy link to clipboard
Copied
​All ​the text in ​all​ the files? What for?
Copy link to clipboard
Copied
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;
}
}
Copy link to clipboard
Copied
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});
}
}
Copy link to clipboard
Copied
Thank you MVP.
But i request you to give here the complete code here as I am not expert in JS.
Will it work like the copied code and will underline or strike through ?
Copy link to clipboard
Copied
That is the complete code, and it will underline every word in the file.
On Sat, Jul 29, 2017 at 7:48 PM, uglyp37942060 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
No need to declare variables like the highlight code ?
Copy link to clipboard
Copied
What is the "highlight code"?
Copy link to clipboard
Copied
// I uglyphoto 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;
}
}
Copy link to clipboard
Copied
Do you mean the highlight color? It's not necessary to specify it, but it's possible if you want to... In the code above replace line #5 with:
this.addAnnot({page: p, type: "Underline", quads: wordQuads, strokeColor: color.yellow});
Copy link to clipboard
Copied
Thank you. Will it give any instruction as pop-ups to click ? I want to avoid any type of pop-up window to click again and again for every file.
Copy link to clipboard
Copied
If you un-tick the "Prompt User" box, then no. Also make sure you add a Save command after the Execute JavaScript command...
Copy link to clipboard
Copied
Thanks again. How to add a Save command ? Whats the command ?
Copy link to clipboard
Copied
It's one of the built-in commands in the Action Wizard, under Save & Export.
On Wed, Aug 2, 2017 at 12:37 AM, uglyp37942060 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
Hi,
How can I underline only numbers ? or a list of given numbers ?
Copy link to clipboard
Copied
You can use the getPageNthWord method to look at the contents of each word, and then decide whether you want to underline it or not.
Copy link to clipboard
Copied
Please help me with that.
Copy link to clipboard
Copied
Send me a PM or email me at try6767 at gmail.com and we could discuss it further.