Scott -

I thought the same thing (use Bitmap/BitmapData). Quick example:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; creationComplete="init()" >
        
        <mx:Script>
                <![CDATA[
        
                        import flash.display.*;
                        import flash.printing.*;
                        import flash.events.*;

                public function init():void {
                        var i:Number = 100;
                        while(i>0) {
my_text.htmlText += "<br>Bob is cool as hell. I love bob. <font face=\"Cochin\" color=\"#333333\"><b>yay!</b></font>bob! bob!";
                                i--;
                        }
                }
                
                public function onClick():void {
                        
var bd:BitmapData = new BitmapData(my_panel.width, my_panel.height, false);
                        var b:Bitmap = new Bitmap(bd);
                        my_image.source = b;
                        bd.draw(my_text);
                        
                        var pj:PrintJob = new PrintJob();
                        pj.start();
                        pj.addPage(my_text as Sprite);// page 1, original text
                        pj.addPage(my_image as Sprite);// page 2, bitmap
                        pj.send();
                }
                                                
                                                                                
                
                ]]>
        </mx:Script>
        
<mx:Panel id="my_panel" title="My Panel" width="100%" height="100%" autoLayout="true" click="onClick()">
        <mx:TextArea id="my_text" width="500" height="400"/>
        </mx:Panel>
<mx:Image id="my_image" width="{my_panel.width}" height="{my_panel.height}"/>
        
</mx:Application>

I didn't try going to a printer but just saved as a pdf. Page 2 looks just like it's displayed in the browser, while page 1 looks like the text has been shrunken horizontally a tad. Strange, but using bitmap should solve your issues for now.

Note... I tried adding the Bitmap object and the BitmapData object to the printJob but it gave me errors so I'm not sure if the image is necessary or not.

John



On May 2, 2007, at 11:24 AM, scott_flex wrote:

I thought about that. I don't know how to make it a bitmap yet but
from what i've seen i should be able to fairly easily...and I assume
i can send a bitmap image to the printer.

In my real app i'm taking a few panels and adding them to a vbox
control so I can create "pages" to send to the printer. I calculate
the height and when the combined height of my panels with text are
taller than a page 700ish pixels high, i create another page... this
also allows me to have a nice print preview screen so they see
exactly how it will print...

--Scott

--- In [email protected], John Mark Hawley <[EMAIL PROTECTED]> wrote:
>
> Can you make the display object into a bitmap and then print that
instead?
>
.



Reply via email to