John,

I ended up going a different route.. i'll use this technique in the 
future.  It was a great expirement.  The print quality just wasn't 
good enough.

Anyway, I wrote a recursive routine to find all Text controls, then 
manually reset their heights for printing.  For reasons, unknown to 
me, when you add a couple pixels to the height of Text object, then 
print, ALL lines print.

Each time i found a Text control in my DisplayObject being added to 
the printJob, i determined line count (oddly, no built in lineCount 
property), went through each line and got the lineMetrics and 
calculated a new height, plus added a few pixels to be sure.  I did 
all this between calling my printJob.start() and printJob.send().

Oh, setting my printJob.printAsBitmap to false is also very good for 
quality and they suggest that in the docs if not printing images or 
non-vector stuff... the print quality is crystal clear!

I agree this is a hack... but when there's LITTLE documentation and 
it doesn't work as expected i was under the gun to get something out 
since i released my app... before testing all printing scenarios...

--Scott

Turning off printAsBitmap on the print job seems to condense the text 
a little so if you only have one word on the last line, it's possible 
that it's brought up to the previous line.  This may cause an extra 
blank space when printed, minor issue, but all text prints, the most 
important thing.

I went through several different fonts and sizes and now very rairly, 
a letter gets clipped on the right, i'll figure this out later.



--- In flexcoders@yahoogroups.com, John Robinson <[EMAIL PROTECTED]> wrote:
>
> Scott -
> 
> I didn't notice the loss of quality when I tested it (quickly)  
> yesterday, but I'm noticing it now that you mentioned it.
> 
> I played with it a bit more but the only thing I found that helped 
at  
> all (though still not great) was to set "smoothing = true" for the  
> Bitmap. It looks better but is now a little fuzzy and on paper 
(cheap  
> inkjet) the text is not as dark as the one without smoothing. I'm  
> wondering if it's possible to overlay the no-smoothing bitmap with 
a  
> transparent background over the smoothed version?
> 
> 
> John
> 
> 
> 
> On May 3, 2007, at 10:55 PM, scott_flex wrote:
> 
> >
> > Thanks for the example John! However, when you printed your output
> > to PDF did you lose a lot of text quality? Printing the 
image/bitmap
> > i lose a lot of quality on the printout, font is real jagged.
> >
> > The bitmap image created from my source panel is very clear on. I
> > assume this is because the flash player is not printing it
> > intellegently as a font but rather an image.
> >
> > Even so though... the bitmap image is pretty darn close to the 
real
> > dimensions of the printed page, based on 72pixel per inch.. Would
> > think i would lose that much qualtily.
> >
> > --Scott
> >
> > --- In flexcoders@yahoogroups.com, John Robinson <jrobinso@> 
wrote:
> > >
> > > 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 flexcoders@yahoogroups.com, John Mark Hawley <mark@> 
wrote:
> > > > >
> > > > > Can you make the display object into a bitmap and then print
> > that
> > > > instead?
> > > > >
> > > >> .
> > > >
> > > >
> > >
> >
> >
> > 
> > Messages in this topic (0)Reply (via web post) | Start a new topic
> > Messages
> > --
> > Flexcoders Mailing List
> > FAQ: 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders% 
> > 40yahoogroups.com
> >
> > Change settings via the Web (Yahoo! ID required)
> > Change settings via email: Switch delivery to Daily Digest | 
Switch  
> > format to Traditional
> > Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
> >
>


Reply via email to