7 Replies Latest reply on Jun 4, 2008 7:13 AM by Patrick Leckey

    Javascript works w/ acrobat pro but does not work w/ reader

    Level 1
      The following script works on a machine w/ Acrobat Professional installed, but does not on one w/ just Acrobat Reader. Should this work w/ Reader, or is Professional required on each client machine?

      I get the following error from the browser on the machine w/ Reader:
      "Error: TypeError
      Error message: Object doesn't support this property or method"

      I load my pdf in an iFrame and I'm trying to print the pdf via JavaScript onClick of a HTML button.

      The following is the script that the html button triggers:
      ==========================================================
      try
      {
      var message = 'Print';
      document.getElementById("PDFObj").postMessage([message]);
      }
      catch (error)
      {
      alert( "Error: " + error.name + "\nError message: " + error.message);
      }
      ===========================================================
      The following is the script inside the pdf:
      ===========================================================

      function myOnMessage(aMessage)
      {
      try
      {
      switch(aMessage[0])
      {
      case "Print":
      printPdf();
      break;
      default:
      app.alert("Unknown message: " + aMessage[0]);
      }
      catch (err)
      {
      app.alert("Caught error: " + err);
      }
      }
      ===========================================================