1 Reply Latest reply on Jan 11, 2008 4:46 AM by inperfect

    Problems with printing

    inperfect
      Hi, everyone!

      I'm working on a project and I need to print from flash. I need to print large images that span several pages and so I have to print different regions from a large sprite. Therefore I add pages by calling several times addPage([sprite], [clipRectangle]). The first call goes fine, but the subsequent calls print the same zone from the sprite, although I provide a new (different) clip rectangle.

      var spriteToPrint:Sprite = new Sprite();
      spriteToPrint.addChild(new BitmapAsset(new BitmapData(400, 200, true)));

      var gr:Graphics = spriteToPrint.graphics;

      gr.clear();
      gr.beginFill(0xFF0000);
      gr.lineStyle(1, 0xFF0000);

      gr.moveTo(0,0);
      gr.lineTo(400,200);
      gr.moveTo(400,0);
      gr.lineTo(0,200);

      gr.endFill();

      var pj:PrintJob = new PrintJob();
      var pjops:PrintJobOptions = new PrintJobOptions(false);

      if(pj.start())
      {
      pj.addPage(spriteToPrint, new Rectangle(0, 0, 200, 100), pjops);
      pj.addPage(spriteToPrint, new Rectangle(200, 0, 200, 100), pjops);
      pj.addPage(spriteToPrint, new Rectangle(200, 100, 200, 100), pjops);
      pj.addPage(spriteToPrint, new Rectangle(0, 100, 200, 100), pjops);
      }
      pj.send();

      pj = null;

      The code above creates a sprite 400 px wide and 200 px heigh, and draws a 2 red lines across. The result of the printing should be 4 pages showing different zones (200 px / 100 px) of the sprite.

      The problem is that all 4 pages show the first region (page), even if I swap addPage lines.

      So if anyone could give me a hint about this, or has come across this issue before and could enlighten me I would greatly appreciate it.