Copy link to clipboard
Copied
i'm using adobe acrobat XI
i want to make a button that can save as the pdf file to local disk such as "D:/test/testing.pdf"
i want to do it using a script
i already look at this website : https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript
but my button did not work, i don't know why
the code i'm using are :
this.saveAs("/d/test/testing.pdf");
and
this.saveAs("/d/test/" + this.documentFileName);
and this one got an error message when i use it
// Split Path into an array so it is easy to work with
var aMyPath = this.path.split("/);
// Remove old file name
aMyPath.pop();
// Add new file name
aMyPath.push("NewFileName.pdf");
// Put path back together and save
this.saveAs(aMyPath.join("/"));
i hope a response for this question
thanks for all your help
Copy link to clipboard
Copied
Use the trusted function on this site:
https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javasc…
Copy link to clipboard
Copied
You must use a trusted function.
Copy link to clipboard
Copied
hello mr bernd
how to use trusted function ?
i never used it before
i've already read several article about trusted function but i not understand yet which code that should i put in the trusted one and which code that i should put in my javascript button function
thanks for your help
Copy link to clipboard
Copied
Install the trusted function and use in the button:
mySaveAs(this, "/d/test/", this.documentFileName);
Copy link to clipboard
Copied
so this code is in the trusted one :
// Split Path into an array so it is easy to work with
var aMyPath = this.path.split("/);
// Remove old file name
aMyPath.pop();
// Add new file name
aMyPath.push("NewFileName.pdf");
// Put path back together and save
this.saveAs(aMyPath.join("/"));​
and this code is in the javascript button :
mySaveAs(this, "/d/test/", this.documentFileName);
is it correct mr bernd ?
thanks for your help
Copy link to clipboard
Copied
Use the trusted function on this site:
https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javasc…
Copy link to clipboard
Copied
which one is the right code sir ? there's a lot of code in that web
thanks
Copy link to clipboard
Copied
You can use the trusted function at "Creating a custom save function".

