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

Javascript security for execMenuItem

Minds
Registered: May 15 2009
Posts: 2

Greatings, this is my first post in this forum, so.. Hello everyone!

I'm preparing an ebook to be deployed via cd, wich consists of a PDF (the book) and an external application (an emulator for the Scheme language).

The last thing I need to do, is to enable text to be selectable in fullscreen mode.

The way I figured to acomplish this was to make a call to app.execMenuItem("SelectMenuItem")..
This would have worked perfectly, if it wasn't for the security issues that came with version 8. SelectMenuItem is not on the list of allowed menus to be invoqued via js..

Problems..
1. The pdf needs to run on a cd, with acrobat reader in windows, linux/unix and mac platforms..
2. I can invoque the execMenuItem method through the console, and folder-level js, but not from a button..
3. Using the trustdFunction method would help.. but the trustedFunction needs to be propagated from a privileged level..

Possible Solutions..
1. Change the registry.. I can add SelectMenuItem and HandMenuItem to twhitelist key on windows registry, using a batch file invoqued from the cd... but, how can I do this in Mac and Unix platforms?

2. Create a js file with the trustedFunction and copy that file to the javascripts folder of Acrobat... but how can I know the path of any acrobat / reader version installed on windows, mac and unix so I can make a batch file to copy the js?

The text that needs to be selectable is some code examples along the ebook.. one alternative could be to create a text form field or an annotation for each example and control it through javascript, but... it's almost 1000 pages... and not enough time to do it...

Does anybody have a better idea?

Thank you.

Paulo

_________________________________________________________
"In God we trust... all others need to supply data."

My Product Information:
Reader 8.0
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Both Mac and Unix use different methods to set Acrobat Preferences. Neither has a registry. I know that the Mac uses preference files that can be found inside the Acrobat Install package on the Mac's programs folder. I don't know about Unix. You're best bet is to install a folder level script on the user's system since this works the same for all platforms. The problem of course is how do you know where to install it.

On Windows the current Acrobat Reader Path is in the registry. Most installer programs are capable of finding this registry key and figuring out where to put things under the Acrobat installation. I don't know about how this info is registered in Mac and Unix, but I'm sure they have similar mechanisms. Are you building installers for all 3 platforms? If not, then you can provide manual instructions to the user for how to install the script. The exact path to the JavaScript folder can be found by running this code from the console window

app.getPath("user","javascript");

You could even provide a button in the root PDF that opens the console window and then places this code into it.

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.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window[/b][/url]

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