Thursday, April 2, 2009

Flex print screen

This is a simple method to do a print screen from flex

private function doPrint(){

var printJob:FlexPrintJob = new FlexPrintJob();
   if (printJob.start() != true) return; 

Application.application.minHeight = Capabilities.screenResolutionY;
Application.application.minWidth = Capabilities.screenResolutionX;

printJob.addObject(UIComponent(Application.application),  FlexPrintJobScaleType.MATCH_WIDTH);
printJob.send();

 application.invalidateDisplayList();
application.invalidateSize();
application.invalidateProperties();
application.initialize();

}


Last and not the least call this function from your button or image or any thing..

1 comment:

Unknown said...

This results in a printed page that doesn't contain the entire flex page. The right and bottom portions are clipped off. Is there any way to get his to work and have the site shrink to fit the printed page?