Skip to main content
Participant
April 14, 2020
Question

Javascript : document actions

  • April 14, 2020
  • 2 replies
  • 308 views

how to add acrobat javascript to set document actions automatically.

I would like to add javascript to "document will save" action in document action menu of Acrobat automatically. 

Any guidance will be much appreciated.

 

 

Thank you,

Nivi

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
April 14, 2020
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
April 14, 2020

You can do it using the setAction method of the Document object, like this:

this.setAction("WillSave", "app.alert(\"The file has been saved.\",3);");

 

Note the second parameter includes the script to execute, but in the form of a String.

nivedithaAuthor
Participant
April 22, 2020

Thank you very much