Highlighted

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

Participant ,
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, PDF forms

Views

38

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

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

Participant ,
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, PDF forms

Views

39

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
Most Valuable Participant ,
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.

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...
Participant ,
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?

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...
Participant ,
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?

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...
Most Valuable Participant ,
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

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

Copy link to clipboard

Copied

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

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...
Resources
One Stop Solution for Acrobat
Edit a PDF