Skip to main content
bobl22244579
Participating Frequently
June 18, 2018
Question

Same "Document Will Save" Action on every document?

  • June 18, 2018
  • 3 replies
  • 3489 views

Hello Everyone,

      Our client uses Adobe Acrobat Pro DC at their office and they have a retention policy in place for the documents they keep on their systems in the office. I've written a  script that sets the document info keyword field to the retention period that they've selected.

     Upon saving the document the user is prompted to set the retention policy with a popup. However, this only works if the "Document Will Save" event is set. It's my understanding that the JS in "Document Will Save" is set on a per document basis. I can't expect my clients to set this action on every single document they open.

Is there a way that i can set this action on any document they open from their copy of Acrobat?

All suggestions are welcome!

Thank you so much!   

    Bob

This topic has been closed for replies.

3 replies

BarlaeDC
Community Expert
Community Expert
June 21, 2018

HI,

Thanks that what I thought, and when dealing with metadata, coding defensively is always the call.

Regards

Malcolm

Legend
June 21, 2018

There is no limit and your code is not adequate for the simplest real world file. You definitely should code defensively and expect any section could be megabytes, it happens. Then you won't be surprised.

Bernd Alheit
Community Expert
Community Expert
June 18, 2018

The client can use a script for this.

bobl22244579
Participating Frequently
June 18, 2018

Mr. Alheit,

     Thank you for your quick response.   This needs to be as transparent as possible to the client as they are not likely to be savvy with scripts, etc. I would like for them to be able to hit save and have it prompt them to set the retention policy if it hasn't already been, and that's it.

     I've done all of the scripting work, I just can't figure out how to set the code in Document Will Save for each document, without the user having to do so.

Thanks again!

     Bob

bobl22244579
Participating Frequently
June 19, 2018

So... If I were creating this project for you, I'd approach it very differently. I'd distribute a folder level script that removes the "Save" and "SaveAs" menu items and tool buttons and replace them with my own versions that do the check for the retention policy info, allows the user to set it if not there and then executes the save programmatically. That way you're not injecting code into the file that you really don't need.


Mr. Geraci,

    I like the sound of this, however it seems like disabling the Save and Save As menu items and tool buttons is forbidden using the Javascript APIs. I've even tried wrapping the hideToolbarButton calls with the beginPriv/endPriv functions.

Please let me know if this is not the case and if I am misusing the API.

Thanks for your suggestion!

     Bob