Hey guys,
I've been trying to print a dynamically loaded jpg and for some reason it's never printing to scale, not sure what I'm doing wrong so here's what I've done so far
var request:URLRequest = new URLRequest(getAbsPath("pages/" + pagePrint + "_big.jpg"));
var loader:Loader = new Loader();
loader.load(request);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
var frame:Sprite = new Sprite()
function completeHandler(event:Event):void {
var picture:Bitmap = Bitmap(loader.content);
var bitmap:BitmapData = picture.bitmapData;
var matrix:Matrix = new Matrix();
matrix.scale(1, 1);
frame.graphics.beginBitmapFill(bitmap, matrix, true);
frame.graphics.drawRect(0, 0, bitmap.width, bitmap.height);
frame.graphics.endFill();
addChild(frame);
frame.visible = false;
printPage();
}
function printPage ():void {
var myPrintJob:PrintJob = new PrintJob();
var options:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = true;
myPrintJob.start();
try {
myPrintJob.addPage(frame, null, options);
}
catch(e:Error) {
trace ("Had problem adding the page to print job: " + e);
}
try {
myPrintJob.send();
}
catch (e:Error) {
trace ("Had problem printing: " + e);
}
}
For some reason that only takes one part of the image and blows it up to fill an entire page... the jpg dimentions are 1280x1656 and I would like it to print the entire jpg... Any ideas what I'm doing wrong?