Highlighted

Adobe Acrobat Reader DC Javascript folder

New Here ,
Aug 09, 2020

Copy link to clipboard

Copied

Hi,

I have been working on some folder-level scripts for a Win10 device which is using a free license of Acrobat Reader DC. I've tried to locate the 'Javascripts' folder on both user and app levels but both are undefined when I used the 'app.getPath("user","javascript");/app.getPath("app","javascript")' functions in the javascript console. I've even tried to manually create directories for them under "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\Javascripts" and "C:\Users\<user>\AppData\Roaming\Adobe\Privileged\DC\Javascripts" and other variants I stumbled across the internet but to no avail. The app just doesn't seem to recognise my .js file no matter where I put it. The current build version of Reader DC for this device is 2020.009.20074

 Please help.

Thanks.

TOPICS
Acrobat SDK and JavaScript

Views

78

Likes

Translate

Translate

Report

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

Adobe Acrobat Reader DC Javascript folder

New Here ,
Aug 09, 2020

Copy link to clipboard

Copied

Hi,

I have been working on some folder-level scripts for a Win10 device which is using a free license of Acrobat Reader DC. I've tried to locate the 'Javascripts' folder on both user and app levels but both are undefined when I used the 'app.getPath("user","javascript");/app.getPath("app","javascript")' functions in the javascript console. I've even tried to manually create directories for them under "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\Javascripts" and "C:\Users\<user>\AppData\Roaming\Adobe\Privileged\DC\Javascripts" and other variants I stumbled across the internet but to no avail. The app just doesn't seem to recognise my .js file no matter where I put it. The current build version of Reader DC for this device is 2020.009.20074

 Please help.

Thanks.

TOPICS
Acrobat SDK and JavaScript

Views

79

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 09, 2020 0
Adobe Community Professional ,
Aug 09, 2020

Copy link to clipboard

Copied

What does you use in the .js file? In the preferences of Acrobat Reader is Javascript enabled?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 09, 2020 0
New Here ,
Aug 09, 2020

Copy link to clipboard

Copied

I have enabled Javascript in the preferences and everything else that's available on the free Reader but I'm not sure that they help. My .js file uses a standard trusted function for a saveAs function, based off the one seen below:

var mySaveAs = app.trustedFunction(
   function(oDoc,cPath,cFlName)
   {
      app.beginPriv();
      // Ensure path has trailing "/"
      cPath = cPath.replace(/([^/])$/, "$1/");
      try{
         oDoc.saveAs(cPath + cFlName);
      }catch(e){
         app.alert("Error During Save");
      }
       app.endPriv();
   }
);

 

Thanks.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 09, 2020 0
Adobe Community Professional ,
Aug 09, 2020

Copy link to clipboard

Copied

Any issue using this function?

Have you created the .js file at "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\Javascripts" or "C:\Users\<user>\AppData\Roaming\Adobe\Privileged\DC\Javascripts" ?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 09, 2020 0
Most Valuable Participant ,
Aug 10, 2020

Copy link to clipboard

Copied

The issue is they don't know where to put the .js file that contains it...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 10, 2020 0
New Here ,
Aug 10, 2020

Copy link to clipboard

Copied

The function works fine when I use it on my main Win10 device which I used to build the function. That machine has Adobe Acrobat Pro 2020. I already put copies of the .js file in both those directories you mentioned. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 10, 2020 0
Adobe Community Professional ,
Aug 11, 2020

Copy link to clipboard

Copied

At the begin of the .js file add this line:

app.alert("test");

What happens when you start/run Acrobat Reader?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 11, 2020 0