header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
gourav
Points:540
Posts:0
Answered

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



1
Connor
Points: 0
Posts:0
Accepted Answer
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"


2
Rex
Points: 1180
Posts:0
Accepted Answer
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();


3
gourav
Points: 540
Posts:0
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

4
Rex
Points: 1180
Posts:0
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 .

5
Shawn
Points: 0
Posts:0
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.

6
abhishek
Points: 0
Posts:0
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


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 7+1 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions