0 Replies Latest reply on Oct 14, 2009 2:30 PM by ITCornelis

    Browser Javascript call Acrobat Javascript function

    ITCornelis

      What I want to do is call a function in Acrobat Javascript by clicking a button in my browser.

      So if you click the browser button it executes a javascript function that calls an acrobat javascript function.

       

      I found this example:

      • Browser javascript

      function printDocument() {

           var pdfObject = document.getElementById(\"PDFObj\");

           pdfObject.postMessage([\"alert\", \"Hello from HTML\"]);

      }

       

      • Acrobat javascript

      In the secure folder (C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Javascripts\kassa.js) my folder level script

      so this is executed for each pdf document.

       

      this.hostContainer.messageHandler =

      {

           onMessage: function(aMessage)

           {

                for(var i = 0; i < aMessage.length; i++)

                console.println("Recvd Msg[ " + i + "]: " + aMessage[i]);

            } ,

            onError: function(error, aMessage){ },

            onDisclose: HostContainerDisclosurePolicy.SameOriginPolicy

      };

       

       

      This should do the job...

      But if i look at the javascript debugger window(acrobat)

      it shows:

       

      this.hostContainer has no properties

      9:Folder-Level:App:kassa.js

      this.hostContainer has no properties

      9:Folder-Level:App:kassa.js

       

       

      Any solution for my problem?