2 Replies Latest reply on Jun 30, 2009 3:16 PM by phongp

    window.print

    Chrissu13
      Hello,

      window.print() is not working in air. There are some workarounds for the application sandbox, but how can I print from javascript in the non-application sandbox?

      Thanks,
      Chrissu
        • 1. Re: window.print
          hmossiii
          hi you need to call into flash runtime window.runtime.flash.printing.PrintJob, you then get the html loader sprite and use that to print
          ex: var print_job = new window.runtime.flash.printing.PrintJob;
          var print_options = new window.runtime.flash.PrintJobOptions;
          print_options.printAsBitmap =true;
          if( print_job.start()){
          var html_sprite = window.htmlLoader;
          print_job.addPage(html_sprite,null,print_options);
          print_job.send();
          }

          This works for me except for fact that scrolling windows represent problems.
          • 2. Re: window.print
            phongp

            hi there,

            I would like to print the html conent from HTML control in Adobe AIR by pressing a button on my component(not a component on HTML page), I tried the solution suggested by hmossiii and found some other detailed sample online. But I got the error Undefined value for window.runtime.flash.PrintJobOptions. It seems like PrintJobOptions is not recognized.

            Can anyone give me a suggestion?