Find text (NO whole words only) and Replace
Copy link to clipboard
Copied
I need to find a text (NO whole words only) and replace it with another in Acrobat Pro. Is there any reason why the "whole words only" option is forcibly selected and grayed out?
Copy link to clipboard
Copied
It can only replace whole words.
Copy link to clipboard
Copied
It can only replace whole words.
By Bernd Alheit
I want to point out how absolutely idiotic that is.
Good gods, do they really not comprehend that we are going to inevitably want to search and replace substrings?
Why even impose this kind of nonsensical restriction in the first place?
Copy link to clipboard
Copied
You can ask Adobe.
Copy link to clipboard
Copied
This may be achieved with javascript though.
Here's a Band-Aid remedy(not elegant, not perfect but useful):
for (var p = 0; p < this.numPages; p++)
{
var numWords = this.getPageNumWords(p);
for (var i=0; i<numWords; i++)
{
var ckWord = this.getPageNthWord(p, i, true);
if ( ckWord == "Acrobat")
{
var q = this.getPageNthWordQuads(p, i);
// Convert quads in default user space to rotated
// User space used by Links.
m = (new Matrix2D).fromRotated(this,p);
mInv = m.invert()
r = mInv.transform(q)
r=r.toString()
r = r.split(",");
l = addLink(p, [r[4], r[5], r[2], r[3]]);
l.borderColor = color.red;
l.borderWidth = 1;
l.setAction("this.getURL('http://www.example.com/')");
}
}
}
Note that the script above creates a red rectangle around the word(s) found. It also converts them to a hyperlink, but you can modify the script to whatever way you need to behave.
This script example is referenced in the Adobe Acrobat SDK JavaScript API Reference, "Doc methods", Example 2, Page 232
This is an action than can be employed as a mouse-up action or as bacth using the Acrobat's built-in Action Wizard tool.
See slides:
You can reuse this action as many times as you need it. To perform a different search each time just change the string of text inside the quotes in the line shown below:
if ( ckWord == "Acrobat")
Copy link to clipboard
Copied
The OP want replace text in the document.
Copy link to clipboard
Copied
I came across the same problem and accidentally found that I had to clear out the search and replace fields and close the edit PDF window. When I did a new search or search and replace, the Whole Words Only option was unselected.

