Copy link to clipboard
Copied
I tried to use the JS script on this page from a few years ago:
I'll copy it here:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.type=="FreeText") {
var annotContents = annot.richContents;
for (var j in annotContents) {
annotContents.textColor = color.green;
}
annot.setProps({richContents: annotContents});
}
}
}
But it is not working for me. Is there some way to update this script to get it to work with the latest version of Acrobat?
Copy link to clipboard
Copied
You're right. It seems the forums system corrupted the code... It should be:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots[i];
if (annot.type=="FreeText") {
var annotContents = annot.richContents;
for (var j in annotContents) {
annotContents[j].textColor = color.green;
}
annot.setProps({richContents: annotContents});
}
}
}
I also fixed it in the original thread linked to above.
Copy link to clipboard
Copied
Looks like something I wrote... It should still work. What happens when you run it?
Copy link to clipboard
Copied
It just says 'undefined' and there's no change.
Copy link to clipboard
Copied
Be sure to select All before running code. It only runs selected lines.
Copy link to clipboard
Copied
Does your file contain "Free Text" comments, added using the "Add Text Comment" tool? Because this code will only edit those.
Copy link to clipboard
Copied
Yes, exactly. Added with the "Add Text Comment" tool.
Copy link to clipboard
Copied
You doesn't use the variables i and j in the script.
Copy link to clipboard
Copied
You're right. It seems the forums system corrupted the code... It should be:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots[i];
if (annot.type=="FreeText") {
var annotContents = annot.richContents;
for (var j in annotContents) {
annotContents[j].textColor = color.green;
}
annot.setProps({richContents: annotContents});
}
}
}
I also fixed it in the original thread linked to above.
Copy link to clipboard
Copied
That was it. It works! Thank you both for the solution.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more