2 Replies Latest reply on Sep 27, 2008 4:03 PM by SWT62

    Printing via BitmapData

    prancius
      Hello,

      Maybe somebody have some example printing on VBox or other component via BitMapData

      I have method to tage bitmap data

      private function getBitmapData( target : UIComponent ) : BitmapData
      {
      var bd : BitmapData = new BitmapData( target.width, target.height );
      var m : Matrix = new Matrix();
      bd.draw( target, m );
      return bd;
      }

      Printing method:

      private function printReport():void
      {
      var printJob:PrintJob = new PrintJob();

      var options:PrintJobOptions = new PrintJobOptions();
      options.printAsBitmap = true;

      var bmp:BitmapData = new BitmapData(500,400,true);
      bmp.draw(this.reportPanel);
      var bitmap:Bitmap = new Bitmap(bmp);

      var tmp:Sprite = new Sprite();
      tmp.addChild(bitmap);

      var rect:Rectangle = new Rectangle(0, 0, 500,400);

      if (printJob.start())
      {
      try
      {
      printJob.addPage(tmp,rect,options);
      }
      catch (error:Error)
      {

      }

      printJob.send();


      }


      I got empty sheet. Why?

      Thank you a lot for any advice