0

I have a button in acrobat form with below script in the Mouse Down.

try
{
  app.saveAs("/c/temp/11.pdf");
}
catch(err)
{
  app.alert(err.message);
}

when I click on the button I get message box says

app.saveAs is not a function.

What is wrong?

FLICKER
  • 6,439
  • 4
  • 45
  • 75

1 Answers1

0

You want doc.saveAs() See tutorial: https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript

Fizz
  • 4,782
  • 1
  • 24
  • 51
  • thanks for fast reply. how I can get the reference to the document I'm working on? if I use doc.saveAs, I get error: doc is not defined – FLICKER Jan 22 '15 at 21:30
  • The current pdf is returned by `this` so `this.SaveAs()`. – Fizz Jan 22 '15 at 21:32
  • now I get: security setting prevent access to this property or method. seems I have to use trusted functions??? – FLICKER Jan 22 '15 at 21:37
  • 1
    Please actually read that tutorial, because there are security settings that may prevent saving. In particular SaveAs will work from the console window as is, but from an actual document script you need to be in the context of a folder-level `trustedFunction` so that you can successfully issue SaveAs. – Fizz Jan 22 '15 at 21:39