1 Reply Latest reply on Mar 4, 2015 10:16 AM by Test Screen Name

    Javascript to open PDF file

    Bob Sneidar

      Hi all. First time posting here. I need to open a PDF file from a javascript I execute using wscript.exe. I also need to fill some form fields. I will be creating the Javascript file on the fly from an app I am developing. The development environment is a scripting based system that does not use javascript, but it DOES have the ability to make shell calls.


      So my goal is to create a .js file on the fly, then open a PFD form and fill it. I already have all the javascript necessary to fill the forms, but I cannot for the life of me find out how to communicate with Acrobat or Reader itself in order to execute the javascript.


      I can, and have, created FDF files, and then opened the file with the Adobe app, and that works fine, but the PDF must first be crafted to open the FDF file upon opening, and I want to avoid that extra step. I want to be able to fill the form directly from my application.


      The development environment is NOT C based ot Java based, otherwise it would be a simple matter of using the prescribed API's for them.


      Any ideas?

        • 1. Re: Javascript to open PDF file
          Test Screen Name Most Valuable Participant

          You can't ask Acrobat to run JavaScript from a file, but you can ask it to run JavaScript from a string. You do this using one of several APIs, not a command line or shell call. VB is probably the best language as it integrates with JavaScript neatly. Whatever you do, you'll need the Acrobat SDK. And none of it will work with the free Adobe Reader, only Acrobat.  (I'm not sure in what way it would be easy if your environment was Java based).