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

how to save as pdf form using script ?

Community Beginner ,
Apr 25, 2018 Apr 25, 2018

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

TOPICS
PDF forms
12.4K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Apr 25, 2018 Apr 25, 2018
Translate
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 ,
Apr 25, 2018 Apr 25, 2018

You must use a trusted function.

Translate
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 Beginner ,
Apr 25, 2018 Apr 25, 2018

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

Translate
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 ,
Apr 25, 2018 Apr 25, 2018

Install the trusted function and use in the button:

mySaveAs(this, "/d/test/", this.documentFileName);

Translate
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 Beginner ,
Apr 25, 2018 Apr 25, 2018

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

Translate
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 ,
Apr 25, 2018 Apr 25, 2018
Translate
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 Beginner ,
May 14, 2018 May 14, 2018

which one is the right code sir ? there's a lot of code in that web

thanks

Translate
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 ,
May 15, 2018 May 15, 2018
LATEST

You can use the trusted function at "Creating a custom save function".

Translate
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