Copy link to clipboard
Copied
Dear Adobe experts,
I am currently using Adobe Acrobat XI Pro and am trying to find a way to remove text boxes (from the drawing markups menu, shortcut is 'x') through a javascript action. I know the right code for it but I am trouble finding the text boxes (console gives me variable is null error). In text box properties, general tab, I have used the author and also tried the subject to find it in my code but to no avail. Here is my code:
var textBox = this.getField("Text Box");
//textBox.value = "TESTING";
textBox.hidden = true;
Any help would be appreciated,
Kind regards
Copy link to clipboard
Copied
What you're adding is not a field, but a comment (the tool you're using is under the Comment panel, after all). The technical term for a comment is an annotation.
To remove an annotation you can use its destroy method, but first you need to locate it. That is not so simple because annotations don't have easy to use names like form fields have. If you have it selected when you run the code then you can remove it like this:
this.selectedAnnots[0].destroy();
Find more inspiration, events, and resources on the new Adobe Community
Explore Now