1 Reply Latest reply on Dec 2, 2008 5:10 AM by Marius Ioana

    Printing Problem with 1.5

    ek_balam
      Hi,
      I'm developing a program including a printfunction with multiple pages. It isn't the best (since AIR is not the best in printing) but it worked until I updated to 1.5. At first I thought - since the program is still in development - that I made a change witch brokes the program. But then I changed the print function to this ...

      // You might find useful to pass some value, number of rows for instance
      function multiplePagePrint(numRows)
      {
      // Create the Print Job
      var pjob = new window.runtime.flash.printing.PrintJob;
      var psprite = window.htmlLoader; // Define the Sprite
      if ( pjob.start() ) // Start the Print Job
      {
      // Define the Print Job Options
      var poptions = new window.runtime.flash.printing.PrintJobOptions;
      poptions.printAsBitmap = true; // Must print it as Bitmap

      //after you've start the print job
      // you can get any print specifics (page size etc.)
      var pageHeight = pjob.pageHeight;
      var pageWidth = pjob.pageWidth;
      var paperHeight = pjob.paperHeight;
      var paperWidth = pjob.paperWidth;

      // Calculate the number of pages
      var pagesToPrint = 1 /** Your logic here **/;

      // Add your pages:
      for(var i = 0; i < pagesToPrint; i++)
      {
      /** Your logic here for calculating RECT_HEIGHT **/
      var rect = new air.Rectangle(0, 0, pageWidth, pageHeight);

      try{
      pjob.addPage(psprite, rect, poptions);
      } catch(e) {
      air.trace(e);
      }
      }

      try
      {
      pjob.send();
      return true;
      }
      catch (err)
      {
      air.trace(err);
      return false;
      }
      }
      else
      {
      air.trace("PrintJob couldn't start");
      return false;
      }
      }

      (Origin from this Blogtext)

      Just for test and in the past it just worked good, but now just a white page !!!!

      A would appreciate a little bit of help. Thanks in advance.

      P.S.: One other thought, I developing a calculation program for car dealers. One week later that programm would be out in the field. Since you can get AdobeAir everywhere online, I never can be sure that the car dealer don't update to newer version, but I think Iit don't come good if one of the key function don't function anymore !!!! Any thought or ideas on this ???

        • 1. Re: Printing Problem with 1.5
          Marius Ioana
          Hi,

          I created a new project having the function multiplePagePrint called when clicking a simple button and didn' t print a blank page. It worked ok.
          Can you detail on how you are using this function in your project? Or maybe it is a issue with the printer itself..

          Marius