Please tell me why the button created from the following script does not work. The button is created and displayed but nothing happens when clicked. Also please point me to where I can find out how to make this button display for all documents in my toolbar.
app.addToolButton({
cName: "OCR",
cExec: "app.execMenuItem('Cpt:CapturePages')",
cTooltext: "Recognize Text using OCR",
cEnable: true,
nPos: 0,
cLabel: "OCR"
});
In order to run this menu item and to create a toolbar button that is availible to all documents you need to do two things. First the code has to be in a Folder Level Script, and second, the execMenuItem function has to be run from a privileged context. Here are some articles that cover these topics:
http://www.acrobatusers.com/tutorials/2006/folder_level_scripts
http://www.acrobatusers.com/tutorials/2008/10/using_trusted_functions
Here's a blog post that discusses the new security features and in Particular the menu Item problem
http://www.acrobatusers.com/blogs/thomp/security-makes-life-difficult-everyone-not-just-you
This article shows how to make a button that runs a trusted function
http://www.acrobatusers.com/tutorials/2007/10/apply_security_with_js
This article show how to create a toolbar button that runs a menu item using the AcroButtons tool,
Although it was written before Acrobat 8 and doesn't use a trustedFunction
http://www.windjack.com/resources/howto/WJHowTo_MenuButton.php
Here's where you can get a free tool for displaying the Language Independant Menu Item Names
(and many other tools):
http://www.pdfscripting.com/public/65.cfm
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script