I've explored the tutorials and help files out there and was able to send a graphic to my printer YAHOOOOOO!!!!
BUT! the problem is the graphics is a red rectangle, and the printed document is a blue rectangle...
And before someone asks... all ink levels are full :)
here is the code...
btn.addEventListener(MouseEvent.CLICK,_Print);
var opt= new PrintJobOptions();
opt.printAsBitmap = true;
var myPrintJob:PrintJob = new PrintJob();
var mySprite:Sprite = new Sprite();
mySprite.graphics.beginFill(0xff0000);
mySprite.graphics.drawRect(0,0,400,200);
addChild(mySprite);
function _Print(evt:MouseEvent):void {
trace("printing started");
myPrintJob.start();
myPrintJob.addPage(mySprite,null,opt);
if (mySprite.height > myPrintJob.pageHeight)
{
mySprite.scaleY = .75;
}
if (myPrintJob.orientation == PrintJobOrientation.LANDSCAPE)
{
mySprite.rotation = 90;
}
var margine_height:Number = (myPrintJob.paperHeight - myPrintJob.pageHeight) / 2;
var margin_width : Number = (myPrintJob.paperWidth - myPrintJob.pageWidth) / 2;
Re: Printing issue. by Marc Poirier on Jun 21, 2008 at 6:12:20 pm
Strangely, when I get the first screen, if I click on print as PDF.. the pdf comes up with a blue rectangle... If I use "open with pdfpen" then it comes out red...
var opt:PrintJobOptions = new PrintJobOptions();
opt.printAsBitmap = true;
var myPrintJob:PrintJob = new PrintJob();
var mySprite:Sprite = new Sprite();
mySprite.graphics.beginFill(0xff0000);
mySprite.graphics.drawRect(0,0,400,200);
mySprite.graphics.endFill();
addChild(mySprite);