I have AS3 code that works nicely to print SWFs, but trying to do the same thing in Flex (print the swfLoader) has not proven to work. I get a blank page.
When I try using the FlexPrintJob class instead, the text outlines from my swfs do not print correctly, and I cannot change the orientation of the page.
I'll pay up to $50 for somebody to get this working in Flex, and perhaps help me set resolution of the output!
Here is the code:
import mx.printing.*;
import [login to view URL];
import [login to view URL];
import [login to view URL];
import [login to view URL];
import [login to view URL];
// Create a PrintJob instance.
private function doPrint():void {
// Create an instance of the FlexPrintJob class.
var printJob:PrintJob = new PrintJob();
var options:PrintJobOptions = new PrintJobOptions();
[login to view URL] = true;
removeMask();
// Start the print job.
if ([login to view URL]() != true) return;
var sp:Sprite = new Sprite();
var a:BitmapData = new BitmapData([login to view URL], [login to view URL]);
var b:Bitmap = new Bitmap(a,"auto",false);
//[login to view URL](stage);
[login to view URL]([login to view URL]);
addChild(sp);
[login to view URL](b)
// Add the object to print. Do not scale it.
// [login to view URL](sp, [login to view URL]);
[login to view URL](sp, null,options);
if(((printJob.orientation=="portrait")&&([login to view URL]>[login to view URL]))||
((printJob.orientation=="landscape")&&([login to view URL]<[login to view URL])))
{
[login to view URL] = -90;
}
var printScale=[login to view URL](([login to view URL]),([login to view URL]));
[login to view URL] = [login to view URL] = printScale;
[login to view URL](sp, null,options);
// Send the job to the printer.
[login to view URL]();
removeChild(sp);
replaceMask();
}
private function removeMask():void {
[login to view URL] = null;
[login to view URL] = false;
}
private function replaceMask():void {
[login to view URL] = [login to view URL];
[login to view URL] = true;
}