Skip to main content
Inspiring
June 6, 2019
Answered

PDF Form Button to run Privileged Script

  • June 6, 2019
  • 1 reply
  • 1424 views

I just got quite a bit of help on another thread and got my script up and running perfectly (Here is the link if anyone wants context: Saving PDF form to specific folder based on field data ).

Now, I'm wanting to run this script via a form button but I'm running into the expected privilege issues you'd expect since I'm running it as Trusted. Is there anything I need to do to my code to make this possible or is it a security setting that will need to be changed?

Here is the script: [JavaScript] Attempt - Pastebin.com

Thanks again everyone, y'all have been a huge help!

This topic has been closed for replies.
Correct answer Thom Parker

Read this article:

Trust and Privilege in Acrobat Scripts

You'll find more info on creating buttons and other automation script features here:

Alerts, Popups, and Other Devices for Interacting with the User

Automating Acrobat can save you loads of time.

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
June 6, 2019

Read this article:

Trust and Privilege in Acrobat Scripts

You'll find more info on creating buttons and other automation script features here:

Alerts, Popups, and Other Devices for Interacting with the User

Automating Acrobat can save you loads of time.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Inspiring
June 6, 2019

Thanks for the links, Thom. The best I can glean from the info is that I should add the file location of the PDFs I'll be adding this button to to Trusted Locations, as the button added and the script it runs are all part of the PDF and would then have the privileges needed. Does that sound about right?

I'll try it when I get into work tomorrow.

Thanks

Thom Parker
Community Expert
Community Expert
June 7, 2019

Yes, it's either that or use a folder level script. Or certify the document with a cert marked for JavaScript privilege.

I always use a folder level script.

BTW: there is never a case where you need to define a "trustedFunction" in a document script. Because if the document is marked as trusted, then all code in the doc is in a privileged context. If not, then it'll never work because a "trustedFunction" requires a privileged context to get defined in the first place.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often