PDF Form Button to run Privileged Script

Explorer ,
Jun 06, 2019

Copy link to clipboard

Copied

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!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

223

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Jun 06, 2019
Thom Parker Adobe Community Professional , Jun 06, 2019
Read this article:Trust and Privilege in Acrobat ScriptsYou'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.

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Jun 06, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Jun 06, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jun 06, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
dandalfini AUTHOR LATEST
Explorer ,
Jun 06, 2019

Copy link to clipboard

Copied

Awesome, thanks for that info! I have a folder level file for it and have submenu/menuitem code for it as well that works fine, but I'm trying to make it more usable with a form button for the older, not tech savvy guys in the warehouse I work in. I also don't want to step on the toes of the IT fella who already takes issue with me making these scripts in the first place. I'll try a few of these things tomorrow to see what'll the least intrusive (so I don't get another passive aggressive phone call, haha) and get it working.

I appreciate your time!

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more