Hi,

Have you tried iterate through each visible line (you can know how many 
lines are visible from verticalScrollPosition) and sum all heights? I've 
been using this method and it's the only reliable way I've found to 
measure the text height.

Also, as John said, you can only make this work with embedded fonts. 
Flash doesn't render text for printing the same way it renders for 
screen (unless the fonts are embedded) and the calculations used the 
screen render, that's why lines get cut off.

You might want to take a look at PrintTextArea which does what you want. 
You can find it here:

http://code.google.com/p/flexreport/source/browse/trunk/flexreport/org/print/PrintTextArea.mxml

Hope this helps,

Frederico Garcia

toofah_gm escreveu:
> I am seeing the same problem...I am using embedded fonts and turning
> anti-aliasing off...the last line of text is often cut off.
>
> --- In [email protected], John Mark Hawley <[EMAIL PROTECTED]> wrote:
>   
>> In order for Flash to know how much room it needs to print an
>>     
> autosized text field, the font must be embedded. There's no way 'round
> it. The _height of an autosized text field without embedded fonts will
> not be correct (for printing).
>   
>>     
>>> From: "scott_flex" <[EMAIL PROTECTED]>
>>> Date: 2007/05/01 Tue AM 08:19:08 CDT
>>> To: [email protected]
>>> Subject: [flexcoders] Re: FlexPrintJob not printing multiple
>>>       
> formatted lines successfully
>   
>>> Geneva, Tahoma and Verdana are 3 problematic fonts i have isolated to 
>>> not print correctly.  I never get the last line of text to print.
>>>
>>> These 3 fonts are installed on my pc.
>>>
>>> The height of my text area is not set, it grows with the amount of 
>>> html text and this has worked very well.  Always showing all text on 
>>> screen but these 3 fonts never want to print the last line.
>>>
>>> However, for these 3 fonts if I set the height of my text control to 
>>> 2 pixels larger that what it would normally grow to when the height 
>>> is not set, everything prints out ok... but I can't set the height of 
>>> my text controls because I don't know ahead of time how much text 
>>> they will contain.
>>>
>>> At this time i plan to remove these 3 fonts from my selection list. 
>>> It's odd since these are pretty common fonts.
>>>
>>> Maybe i need to embed the fonts in the app itself, probably the 
>>> safest since other users may not have the same font list as I.... but 
>>> that's why i was sticking with common fonts.
>>>
>>> Any other insight would be helpful....
>>>
>>> --Scott
>>>
>>>
>>>
>>>
>>> --- In [email protected], "scott_flex" <skrause@> wrote:
>>>       
>>>> Well.... i have determined that it really doesn't matter what font 
>>>> family or size it is.... it just won't print the last line even 
>>>> though all lines appear on screen with no scroll bars.
>>>>
>>>> The html text of my mx:text object is:
>>>> <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" 
>>>> SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">When i try 
>>>>         
>>> to 
>>>       
>>>> print this text from a mx:text control and the text wraps to more 
>>>> than one line, the last line will not print.  It just prints a 
>>>>         
>>> white 
>>>       
>>>> blank line intstead.  My mx:text component is set to 400 width 
>>>>         
>>> which 
>>>       
>>>> is inside a grid item which inside a grid row which is inside  
>>>>         
>>> mx:gid 
>>>       
>>>> object.</FONT></P></TEXTFORMAT>
>>>>
>>>> The width of my mx:text object is set to 400... and even though the 
>>>> first few lines print they don't line break exactly as they do on 
>>>> screen... just thought that was odd but probably has something to 
>>>>         
>>> do 
>>>       
>>>> with the scaling when it prints.  I just want it to print the last 
>>>> line.
>>>>
>>>>
>>>> Any help would be greatly appreciated... i'm desperate for ideas of 
>>>> what might be the issue.
>>>>
>>>> --Scott
>>>>
>>>>
>>>> --- In [email protected], "scott_flex" <skrause@> wrote:
>>>>         
>>>>> I have a text control displayed with multiple lines of wrapped 
>>>>>           
>>>> text , 
>>>>         
>>>>> no scroll bars, all text is completely displayed on screen.  When 
>>>>>           
>>> i 
>>>       
>>>>> send this text to the printer only the first line is printed.
>>>>>
>>>>> The text control is displaying html formatted text.  This only 
>>>>>           
>>>> happens 
>>>>         
>>>>> to certain font/size combinations.  Verdana 11 prints first line 
>>>>>           
>>>> only, 
>>>>         
>>>>> second and 3rd lines don't print, even though they are on screen 
>>>>>           
>>>> ok.  
>>>>         
>>>>> Verdana 12 prints just fine, 2nd and following lines print ok.
>>>>>
>>>>> I've set the print object to NOT print as bitmap 
>>>>>           
>>>> (printAsBitmap=false) 
>>>>         
>>>>> and the scale type for each object added to the print job is set 
>>>>>           
>>> to 
>>>       
>>>>> show all.
>>>>>
>>>>> Haven't figured out why this happens for some font/size 
>>>>>           
>>>> combonations... 
>>>>         
>>>>> any ideas?
>>>>>
>>>>>           
>>>
>>>
>>>       
>> --
>> John Mark Hawley
>> The Nilbog Group
>> 773.968.4980 (cell)
>>
>>     
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: 
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
>
>
>
>
> __________ NOD32 3085 (20080508) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   

Reply via email to