6 Replies Latest reply on Oct 31, 2014 7:54 AM by gkaiseril

    Password protect javascript via VBA

    JoshSnitzel

      Hey all,

      I need to execute javascript from my VBA code that will password protect my PDF file. I am currently using the method below:

      AForm.Fields.ExecuteThisJavaScript password_js

      where password_js is a variable with the javascript code in it. I have executed other javascript this way (adding text to the pdf) and it works fine.

      The javascript I am trying is from Applying PDF Password Security Using Acrobat JavaScript and works fine when run from within acrobat but it's not working through VBA. One thing I noticed is that when run from acrobat a save dialog pops up but through VBA nothing happens at all..

       

      Anyone know a simple way to do this? The password will be the same each time it is used - currently it is applied using the action wizard in acrobat but if I can run it via VBA after exporting the file to PDF it would be very nice!

      Thanks,

      Josh