private var _printableContent:Sprite = new Sprite(); private var _textField:TextField = new TextField(); private var _loader:URLLoader = new URLLoader();
public function Printing() { _loader.load(new URLRequest("http://www.navioo.com/m.txt")); _loader.addEventListener(Event.COMPLETE, completeHandler);
private function completeHandler(event:Event):void { _textField.text = _loader.data; var printJob:PrintJob = new PrintJob(); if(printJob.start()) { var pages:Number = Math.ceil(_textField.height / printJob.pageHeight);
_textField.width = printJob.pageWidth;
for(var i:Number = 0; i < pages; i++) { printJob.addPage(_printableContent, new Rectangle(0, i * printJob.pageHeight, printJob.pageWidth, printJob.pageHeight)); } printJob.send(); _textField.width = 400; } } } }
Related Scripts with Example Source Code in same category :