1 Reply Latest reply on Aug 12, 2016 1:35 AM by try67

    Removing a text box (drawing markups) through javascript

    pierrem17659459

      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

        • 1. Re: Removing a text box (drawing markups) through javascript
          try67 MVP & Adobe Community Professional

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