6/23/2010 2:54:30 AM
Title:
how to print in air/flex.
hii all..
i need to print the text available in my RichTextEditor.
or simply give me any method to print text available in Textarea.
note:
1). I only want to print text no border of component .
2). full text (available in textarea).
3) i have one code but i got some error
6/23/2010 3:42:29 AM
capture the bitmap of the text area and add the captured area to a sprite after that print the sprite , here is the code for capturing a textarea and adding bitmap to the sprite
var previewBM:BitmapData = new BitmapData(myTxt.width,myTxt.height);
previewBM.draw(myTxt);
capturedBitmap = new Bitmap(previewBM);
mySprite = new Sprite();
mySprite.addChild(capturedBitmap);
rawChildren.addChild(mySprite);
// now you can print the "mySprite"
6/23/2010 4:27:25 AM
you can print your sprite using following code in flex using actionscript 3
var myPrintJob:PrintJob = new PrintJob();
var myOptions:PrintJobOptions = new PrintJobOptions();
options.printAsBitmap = false;
myPrintJob.start();
try{
myPrintJob.addPage(spriteToPrint, null, options);
}catch(e:Error){
global.dbg("error while Printing: "+ e);
}
myPrintJob.send();
6/23/2010 4:57:31 AM
i need to print full text within textarea.it means if more then one page of data exist in my text area then my other pages are not visible to the user?
is this code can print all these page ?
or any one have idea for that.
thanks for reply
6/23/2010 5:10:06 AM
if the printing data exceeds the page size the printer creates a new page automatically. In case you want to control that , then you should do a check by printing the max textArea size that can be printed in A4 size paper or whatsoever your printer page size is . And if the text exceeds the text area then you need to create a new text box .
6/23/2010 5:42:08 AM
create a new textbox and fix the width so that it does not exceed the width of paper , let it expand with text in height. Now capture this text box to print . The width is fixed so when the height of text box will exceed the height of printing paper , printer will shift the remaining text to the next page.
5/16/2011 10:24:04 PM
i want similar thing, is any solution thr?
Plz see my post .
http://askmeflash.com/qdetail/1548/how-can-we-print-s-list-data-in-flex