Thursday, December 20, 2007

printAsBitmap - object must be on stage

This blog has moved.

just for future reference, I've discovered today something that appears to be undocumented - when setting a PrintJob to printAsBitmap=true OR you are printing from a mac,(using the PrintJobOptions class) it is suddenly important that the object is on the stage, or it won't print.

so if you didn't want your object on the stage, the simple solution is to surround your send with an addChild and removeChild like so:


this.addChild(page);
page.visible=false; //for macs only - otherwise they display the page while the print dialogue is open.
var myOption:PrintJobOptions = new PrintJobOptions(true);
my_pj.addPage(page,null,myOption);
my_pj.send();
this.removeChild(page);

2 comments:

Shaun said...

Hi

Is there an AS2 workaround that you can think of? We seem to have come across the same problem although, it's happening in Windows too.

Only thing is, we're using AS2 for this particular project.

Thanks

Shaun

Craig Grummitt said...

Sorry I don't have a printer handy to test code out for you. Does seem strange that you've come across the same problem - what do you mean by that? that the object needs to be on stage? doesn't the clip have to be on stage to be able to reference it in the PrintObject in AS2?