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

I want to specify the user's desktop in "cPath" specified in "saveAs" method..

Participant ,
Jul 12, 2020 Jul 12, 2020

Copy link to clipboard

Copied

I want to specify the user's desktop in "cPath" specified in "saveAs" method, but I don't know how to set the path.

 

What should I do with the location of "username" ?
Is it useless below?


Used in a multilingual environment.

this.saveAs("/c/Users/%userprofile%/" + aaa + ".pdf");

TOPICS
Acrobat SDK and JavaScript

Views

425

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
community guidelines
Community Expert ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

There's no direct way of doing it. What can be done, though, since you have to run your code from a trusted context anyway is to use the app.getPath method to access one of the other user folders, like the Documents ones, and from there get the Desktop path. It's a bit of a hack, but it does work, as long as keep in mind that it can vary per operating system.

Votes

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
community guidelines
Participant ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

very thank you for your advice. I've never used the app.getPath method, but I'll check it. The difference in operating system is the difference from Windows 10 or 7, right? Or is it Mac?

Votes

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
community guidelines
Participant ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

Create a text box in the field and put it there

var i = app.getPath("Documents");
event.value = i.value;

I wrote, but nothing is displayed. .. ..

Is something wrong?

Votes

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
community guidelines
Community Expert ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

You have errors in your code, but also you can't use this method like that. Read up its documentation, especially the part related to the limitations of running it in a privileged context. Also see: https://acrobatusers.com/tutorials/trust-and-privilege-in-acrobat-scripts

Votes

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
community guidelines
Participant ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

LATEST

I understood. This sounds difficult to me, but I'll read it.
Thank you for your advice.

Votes

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
community guidelines