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

Help with Save As using JavaScript

Explorer ,
Nov 30, 2017 Nov 30, 2017

Hi All,

This is my first attempt at using Javascript...

I am attempting to create a Save As button on a form that will:

  • Create a file name based on fields;
  • Save to a specific folder (And if it doesn't exist then create folder);
  • Bring up the "Save As" box for confirmation (as opposed to a silent save);
  • Bring up a warning IF Adobe is going to save over an existing pdf (aka has the exact same name);
  • Close Adobe after all of the above is executed.

So far I have been fairly successful. I have been able to do a silent save, saving to a specific location and saving the file name based on fields. I need help building the rest of the functionality into the code if possible.

Thanks in advanced!

-------------------------------------------------------------------------------------------------------------------------

The code I have so far is:

Trusted Level Function

saved in Notepad under the Adobe / Javascript folder

mySaveAs = app.trustPropagatorFunction(function(doc,path) {

app.beginPriv();

doc.saveAs(path);

app.endPriv();

})

myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path) {

// Privileged and/or non-privileged code above

app.beginPriv();

mySaveAs(doc,path);

app.endPriv();

// Privileged and/or non-privileged code below

});

PDF Button

Code under button that is executed on Mouse up click

// build file name

var myFileName = getField("Work_Pack").value + " - " + getField("Form_Name").value + " - " + getField("Todays_Date").value + ".pdf";

// add folder name

myFileName = "/c/temp/Saved Forms/" + myFileName

myTrustedSpecialTaskFunc(this, myFileName);

this.closeDoc() ;

-------------------------------------------------------------------------------------------------------------------------

TOPICS
Acrobat SDK and JavaScript , Windows
29.3K
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

correct answers 1 Correct answer

Explorer , Jan 10, 2018 Jan 10, 2018

FYI for those interested I used the following:

Trusted Level Function

saved in Notepad under the Adobe / Javascript folder

mySaveAs = app.trustPropagatorFunction(function(doc,path) {

app.beginPriv();

doc.saveAs(path);

app.endPriv();

})

 

myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path) {

// Privileged and/or non-privileged code above

app.beginPriv();

mySaveAs(doc,path);

app.endPriv();

// Privileged and/or non-privileged code below

});

PDF Button

Code under button that is executed on Mouse up cl

...
Translate
New Here ,
Jul 25, 2018 Jul 25, 2018

Try67 please let me know if you can help me with the file i have i'm willing to pay. 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 ,
Jul 26, 2018 Jul 26, 2018

Yes. You can contact me via try6767 at gmail.com .

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