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

Alert box upon opening pdf file

medesigner
Registered: Jul 30 2008
Posts: 3

I'm trying to add an alert box via javascript so that when the user first opens the pdf document, an alert box with my disclaimer comes up and the user must click ok before viewing the document. I'm using standard v 7.0, and don't seem to have the javascript console. Can this be done? They will be opening the pdf file from a cd. Where can I find the correct code? Thanks

My Product Information:
Acrobat Standard 7.0.9, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
The JavaScript console is not a standard part of Standard version 7. With version 7, one could use the document's "Page Open" action to get to the "Run JavaScript" action and then add the necessary code to display the alert box as a page open action.

You will have to download a short appliction level JavaScirpt from the [link:http://www.adobe.com/devnet/acrobat/] documentation tab called "TestDebugger for Windows and Macintosh" and install the contents of the compressed library into Acrobat's JavaScript appliction folder to create the JavaScript Debugging Console.

You can also add the following JavaScirpt to Acrobat's JavaScript appliction folder to open the JavaScript conosle from the "Advanced" Menu option:

// add JavaScript Console to Acrobat's Advanced menu option
app.addMenuItem({
cName: "JavaScriptConsole",
cUser: "JavaScript Console",
cParent: "Advanced",
nPos: 7,
cEnable: (true),
cExec: "console.show();"
});

If you goto [link:http://www.windjack.com/products/freestuff.php]JavaScripts Created With AcroButtons] and download the JavaScript Console for Adobe Reader 7.0[/rul] compressed library. You can extract the files to Acrobat's application JavaSript file you will not only have the debugging console but also a toolbar button.

To have any application level JavaScript become effective after editing or adding you must exit Acrobat/Reader and restart the appliction.

This will not provide you with the Document Level JavaScirpt editor, but one could execute a JavaScript through the console that would become a document level JavaScript.

You might also want to get a copy of the [url=http://www.adobe.com/devnet/acrobat/javascript.php]Acrobat JavaScript docuemntaiton[/url].

George Kaiser

medesigner
Registered: Jul 30 2008
Posts: 3
Cool thanks. I added the console and added the js needed to add the alert box on the page open action. Thanks a bunch! :)