Skip to main content
Participant
September 9, 2023
Answered

Where did the JavaScript Samples Portfolio install its samples?

  • September 9, 2023
  • 1 reply
  • 740 views

I am just getting started with calling the Acrobat JavaScript API, and I am stuck making the SDK work.

I successfully downloaded the Adobe DC SDK for MacOS. I found a file within, Acrobat SDK JavaScript Samples Portfolio.pdf, and copied it to my working directory. When I open the portfolio, a dialogue appears. It lists the contained samples, and gives a button, "Install Folder-level JavaScript Samples". I press the button. An alert appears, telling me that "some high privilege Javascript… must be executed from the JavaScript Debugger console…." I click the "OK" button. A block of code appears in the Javascript Debugger console (yes, it is enabled). I click in the block of code, press cmd-A to select all the lines of the code, and press cntrl-Return.

Observed behaviour: there is a flash of UI in the upper-right corner of my display. It comes and goes so fast I cannot read it, or even really see it. The block of code is gone from the Javascript Debugger window. There is no new file in my working directory. There is no visible clue where the Samples Portfolio code actually installed the samples.

Expected behaviour: the code prompts me for a folder into which to install the samples, and I direct it to my working directory. Failing that, the code chooses a directory it likes, but then clearly tells me where that folder is.  (Also, I expect the code in the JavaScript Debugger console pane to remain visible, but that is not the important issue.)

Where did the JavaScript Samples Portfolio install its samples? Or, if it failed, how can I diagnose the failure and correct it?

Thanks in advance for your help.

 

I am using Adobe Acrobat Pro, Continuous Release version 2023.003.20215 on macOS Monterey 12.6.8 with an M1 Max CPU. I downloaded the current Adobe DC SDK for MacOS, version v4 - May 2023.

 

This topic has been closed for replies.
Correct answer Jim DeLaHunt

Answer 1: the instructions notwithstanding, on macOS it appears that the key sequence to press is command-Return, not control-Return.  (The control key modifier is probably specific to Windows.)

 

Observed behaviour: upon pressing command-Return, an alert dialogue appears, with the following text:

quote

Please take a moment to write down your User JavaScript Folder location:
/Macintosh HD/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/JavaScripts/

You will be prompted a file selection dialog box for each of the
folder-level JavaScript samples contained in the samples portfolio.

To ensure proper intallation of the samples, for each file selection dialog:
1. Change the JavaScript samples file extension from ".jss" to ".js";
2. Change directory to the user JavaScript folder location as shown above;
3. Click OK to accept;
4. Repeat (1)~(3) until all samples are extracted and copied to the user JavaScript folder.

Click OK when you are ready to proceed.

 

Then a succession of file save dialogues appears, one for each sample. Finally, alert dialogue appears, with the following text:

quote

Folder-level JavaScript samples successfully copied to the user JavaScript folder.

Quit and restart Acrobat to have the samples loaded and ready to use.

 

So, Answer 2 is that the samples are saved whereever the user specifies in the file save dialogues.

 

By the way, I believe that the above path is my app, rather than user, JavaScript Folder location. I believe the text is not in sync with the code. To see both locations, run the following code in the JavaScript debugger. The resulting paths
appear just below your code in the debugger pane.

app.getPath("app","javascript")+'\n'+app.getPath("user","javascript");

On my system I get:

/Macintosh HD/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/JavaScripts/
/Macintosh HD/Users/myuserid/Library/Application Support/Adobe/Acrobat/DC/JavaScripts/

By the way, some feedback for the Adobe folks who author these SDKs: you do not have to bury this explanatory information in executable code. The code samples are packaged in a PDF file. You could put the text presently displayed only by the installer code also into the pages of the PDF file, so that a user opening the code samples document will understand exactly that they have to do and what will happen, before they run the code. You also do not need to write instructions for Windows only. There is enough room to write, "…press control-Enter (command-Return on macOS)."

 

1 reply

Jim DeLaHuntAuthorCorrect answer
Participant
September 9, 2023

Answer 1: the instructions notwithstanding, on macOS it appears that the key sequence to press is command-Return, not control-Return.  (The control key modifier is probably specific to Windows.)

 

Observed behaviour: upon pressing command-Return, an alert dialogue appears, with the following text:

quote

Please take a moment to write down your User JavaScript Folder location:
/Macintosh HD/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/JavaScripts/

You will be prompted a file selection dialog box for each of the
folder-level JavaScript samples contained in the samples portfolio.

To ensure proper intallation of the samples, for each file selection dialog:
1. Change the JavaScript samples file extension from ".jss" to ".js";
2. Change directory to the user JavaScript folder location as shown above;
3. Click OK to accept;
4. Repeat (1)~(3) until all samples are extracted and copied to the user JavaScript folder.

Click OK when you are ready to proceed.

 

Then a succession of file save dialogues appears, one for each sample. Finally, alert dialogue appears, with the following text:

quote

Folder-level JavaScript samples successfully copied to the user JavaScript folder.

Quit and restart Acrobat to have the samples loaded and ready to use.

 

So, Answer 2 is that the samples are saved whereever the user specifies in the file save dialogues.

 

By the way, I believe that the above path is my app, rather than user, JavaScript Folder location. I believe the text is not in sync with the code. To see both locations, run the following code in the JavaScript debugger. The resulting paths
appear just below your code in the debugger pane.

app.getPath("app","javascript")+'\n'+app.getPath("user","javascript");

On my system I get:

/Macintosh HD/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/JavaScripts/
/Macintosh HD/Users/myuserid/Library/Application Support/Adobe/Acrobat/DC/JavaScripts/

By the way, some feedback for the Adobe folks who author these SDKs: you do not have to bury this explanatory information in executable code. The code samples are packaged in a PDF file. You could put the text presently displayed only by the installer code also into the pages of the PDF file, so that a user opening the code samples document will understand exactly that they have to do and what will happen, before they run the code. You also do not need to write instructions for Windows only. There is enough room to write, "…press control-Enter (command-Return on macOS)."