Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adding custom .js file for it to work in Adobe Reader (without the pro version)

New Here ,
May 19, 2016 May 19, 2016

I have created a PDF form using Acrobat Pro X, in order to use a few restricted functions I created a .js file and included all those functions as trusted functions.

To use these functions I placed this .js file in the Javascripts folder on my system.

But I don't see such a folder on systems with only Adobe reader, instead I see a folder named "JSCache" it doesn't show any .js files in it and if I place my custom .js file in it my form doesn't work properly.

Please guide me in this regard. The following screen might come in handy.

Adobe1.png

Thanks

TOPICS
Acrobat SDK and JavaScript , Windows
4.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 19, 2016 May 19, 2016

You shouldn't be doing anything with the JSCache folder. Leave it alone and add the "Users\(username)\AppData\Roaming\Adobe\Acrobat\Privileged\10.0\JavaScripts" folder, or whatever it is for the Reader version you're using. The point is you have to manually create the Privileged folder and the two other folders underneath it.

Translate
Community Expert ,
May 19, 2016 May 19, 2016

If the JavaScripts directory does not exist, you will have to create it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2016 May 19, 2016

Thanks for the reply khkremer but that doesn't help. I checked in the JSCache and found this;

Adobe2.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2016 May 19, 2016

You shouldn't be doing anything with the JSCache folder. Leave it alone and add the "Users\(username)\AppData\Roaming\Adobe\Acrobat\Privileged\10.0\JavaScripts" folder, or whatever it is for the Reader version you're using. The point is you have to manually create the Privileged folder and the two other folders underneath it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2016 May 19, 2016

Correction: Thanks George, I was placing the Privileged folder in wrong location, I got it working!

adobe5.PNG

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2016 May 19, 2016

You're not adding the correct folders, so remove any that you've manually added.

You need to add a Privileged folder in the Acrobat folder, then add a 11.0 folder in the Privileged folder, then add a JavaScripts folder in the 11.0 folder, then add your JavaScript files in the JavaScripts folder. Then restart Acrobat for the code in the JavaScript file(s) to be loaded into Acrobat.

For Reader, things are slightly different, but the pattern is the same.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2016 May 19, 2016

Sorry, I did not realize that you were using Adobe Reader X - for that, you need to follow George's link and create the missing directories.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2016 May 19, 2016
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2016 May 19, 2016

Thanks for the response George, but I don't have that privileged folder on my system at the location mentioned in that document.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2016 May 19, 2016

Then you need to first create the "privileged" folder, then version number folder, and then the "JavaScripts" folder. You cannot create them in one shot.

If you have both Acrobat and Reader installed, they share the privileged\version\JavaScript folder so if you have folder level scripts for Acrobat you may need to code to those JS files so the code does not run when Reader is opened. I also add a folder named "JavaScriptsNotUsed" to hold JavaScript files I do not want to run or I am developing. This folder allows me to move files from the JavaScripts folder and prevent them being run when Acrobat/Reader starts.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 20, 2016 May 20, 2016
LATEST

That's a useful practice, I will implement it.

Thanks gkaiseril.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines