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

config.js file location

JustinH
Registered: Feb 1 2010
Posts: 8

Hello,

I've read many topics regarding saving a PDF using privileged functions in the config.js. They have been useful no doubt; however, I've run into a problem.

When deploying my config.js to several users who may have multiple versions of acrobat reader/standard/professional installed it is often hard/impossible to find what directory the config.js file should be stored in. I know you can use app.getPath("user","javascript") and app.getPath("app","javascript") but I'm not sure how to use those functions on computers with only reader installed.

So my question from all of this is how to correctly add a config.js file to the folder level javascript location on machines with multiple installations. Thanks for your help.

-Justin

My Product Information:
Reader 9.2, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You can save your folder level functions in any '.js' file in the Acrobat application JavaScript folder or in the user's application Acrobat JavaScript folder.

Installation of multiple versions of Acrobat/Reader is discouraged by Adobe. Each version of Acrobat/Reader has it's own JavaScript folder. As is the installation of Acrobat and Reader on one system.

You can make a PDF with a button to run the code and display the result in an 'alert' message box. You could also search for the 'user' folder for JavaScript. You could use this approach to not only obtain the folder path but also other data about the Acrobat/Reader installation. If there are multiple versions installed, you would need to use the script in each of the installed versions.

var cMsg = "JavaScirpt paths:\n";var cText = "";try {cText = 'Application folder level JavaScripts path:\n    ' + app.getPath("app","javascript") + '\n';} catch(e) {cText = "   No application level JavaScript folder found.\n";}cMsg += cText;try {cText = 'User folder level JavaScripts path:\n    ' + app.getPath("user","javascript") + '\n';} catch(e) {cText = "   User has not defined any folder level JavaScripts.\n";}cMsg += cText;app.alert(cMsg, 3, 0);

George Kaiser

JustinH
Registered: Feb 1 2010
Posts: 8
Thanks for the quick replay. I will try this out.
JustinH
Registered: Feb 1 2010
Posts: 8
I tried the solution (quickly) on my own machine. When I do the following in the javascript debugger it works:

app.getPath("app","javascript");
However, when I run it off a button click (mouseup) event I get the follow error:

Exception in line 1 of function top_level, script AcroForm:Check for Javascript Locations:Annot1:MouseUp:Action1 NotAllowedError: Security settings prevent access to this property or method.App.getPath:1:AcroForm:Check for Javascript Locations:Annot1:MouseUp:Action1

Is app.getPath a trusted function?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Yes, it is a trusted function. But if you certify you PDF with a trusted certificate and install the certificate on you systems, you should be able to use it.

George Kaiser

JustinH
Registered: Feb 1 2010
Posts: 8
Thanks again for the information gkaiseril. Very much appreciated.