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

Basic workflow of using JavaScript in Acrobat Documents

asmohr
Registered: Sep 2 2007
Posts: 25

Hi folks,

I've been poring over the Adobe doc and getting nowhere. It all seems to
presume that I'm already past Step 1.

I want a script saved within a document and I can't figure out how to get it
there or how to execute it. (See -- this really is Step 1.)

I'm on Windows. (No excuses, it just is.)
If I save the script in C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Javascripts
then it load when Acrobat starts. OK so far.

But I want the script to be part of the document so that I can give it to others
and they won't have to install something under Program Files\Adobe that
might get in the way other uses of Acrobat. (Sounds good in theory.)

In the Debugger, the scripts in the folder show up under App.
The menu option Advanced > JavaScript > Document JavaScripts...
opens a JavaScript Functions window that will add things, but they have to
have a name. I can't browse to my script file, I have to paste the script in.
But under WHAT NAME? App? Exec? Fubar?

Once pasted in, how do I execute it? The script adds menu items and defines
functions for those menu items. How do I get it to run after pasting it in?
Save the file and reopen it?

Does this mean my workflow for debugging cycles through Edit outside file,
Copy, Paste, Save, Re-open, Test, Edit outside file, Copy, Paste, Save,
Re-open, Test, etc.

Or is there an easier way?

I can't find any information that says anything at this level.

Anyone got any suggestions for where to look?

Thanks,
August

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
If you want to include a script within a PDF you must place the script within the document as a document level script or page action of in one of the field action scripts. Not all JavaScripts can be placed within a document because Acrobat, more advance users, and system administrators do not want scripts modifying applications or system setting without their review and approval. For these type of scripting methods, one needs to allow a user at the other end to add the scripts to one of their application JavaScript application folders, all users or specific users. The "addMenuItem()" is a method that is restricted to the application initialization, that is, the user or the user's system administrator must add the script to their system. This restriction is spelled out within the JS documentation by the icon in the 3rd column..

George Kaiser