views:

15

answers:

0

Hi Everybody,

Hopefully someone can see something which I've missed out or something, because this is really odd! Basically I've created a print class which has all the print job code in to print a sprite, however when I print it, the sprite which I've created acts like a mask and the area where the sprite graphic should be is filled with my background colour.

So for example, my 100x100 black sprite looks like this in preview: http://www.willdonohoe.com/examples/print_job_fail.png

When I scale the image to the width and height of the print width and height, obviously I've got a page full of purple.

Anyway here's my code:

public function print():void {

 //bitmap_to_print.smoothing = true;

 var print_page:Sprite = new Sprite();
 var sp:Sprite = new Sprite();
 sp.graphics.beginFill(0x000000, 1);
 sp.graphics.drawRect(0, 0, 100, 100);
 sp.graphics.endFill();
 print_page.addChild(sp);

 var print_job:PrintJob = new PrintJob();
 addChild(print_page);

 if (print_job.start()) {

   trace(">> pj.orientation: " + print_job.orientation);
   trace(">> pj.pageWidth: " + print_job.pageWidth);
          trace(">> pj.pageHeight: " + print_job.pageHeight);
          trace(">> pj.paperWidth: " + print_job.paperWidth);
          trace(">> pj.paperHeight: " + print_job.paperHeight);

   print_page.height = print_job.pageHeight;
   print_page.scaleX = print_page.scaleY;

   print_job.addPage(print_page);
   print_job.send();

   print_job = null;

 } else {

  //User does not have printer or user cancelled print action
 }
 removeChild(print_page);
}

If anybody has any idea, or had this problem before then any help will be greatly appriciated.
Many thanks,
Will