These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Comment/Markup Buttons

whitey4412
Registered: Apr 15 2008
Posts: 2
Answered

I'm pretty new to all of this but is there a way to add a JavaScript to a button in Acrobat Pro so that it changes the active tool to one of the tools on the Comment and Markup Toolbar such as the pen or circle?

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Why yes, there is. Each of these tools has an associated menu item, and you can call a menu item from Acrobat JavaScript. Unfortunately, with Acrobat 8, this has become much more difficult than it used to be. Acrobat has a white list of menu items that can be executed from a non-privileged context. The commenting tools are not on this list, which means that you either have to change the white list (it's in the Registry on Windows, and in a config file on the Mac), or call the "app.execMenuItem()" function from a trusted function. Both of these options require changes on the users system. They cannot be done from a document script.

Look up the "app.execMenuItem()" function in the Acrobat JavaScript Reference. Example 4 in the entry shows how to use a trusted function for this.

Also take a look at this blog entry.
http://www.acrobatusers.com/blogs/thomp/?p=10

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script