Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Removing a text box (drawing markups) through javascript

Guest
Aug 12, 2016 Aug 12, 2016

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;

Capture.PNG

Any help would be appreciated,

Kind regards

TOPICS
Acrobat SDK and JavaScript
394
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2016 Aug 12, 2016
LATEST

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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines