Hi Glen, This is quite similar to what we did. We first created a BitmapData of the scene and then printed that. Even posted about it :-) http://techblog.floorplanner.com/2008/10/22/printing-and-big-bitmaps/ But it feels like there should be an easier way...
Gert-Jan 2008/10/25 Glen Pike <[EMAIL PROTECTED]> > Hi, > > Here is some AS2 code that I wrote to do this - the _toPrint is a > MovieClip containing lots of stuff with filters on. There is scaling too - > depending on whether the user has chosen portrait or landscape - for later > AS3 code, I worked out the orientation and rotated the printed image - not > bitmapped though... > The whole lot is rendered to a Bitmap, then printed. > > Hope this helps. I may even get round to blogging it one day :) > > Glen > > private function _print():Void { > //start a print job with the _toPrint... > // create PrintJob object > var my_pj:PrintJob = new PrintJob(); > > // display print dialog box, but only initiate the print job > // if start returns successfully. > if (my_pj.start()) { > // use a variable to track successful calls to addPage > var pagesToPrint:Number = 0; > //we need to scale the object too! > var h:Number = my_pj.pageHeight; > var w:Number = my_pj.pageWidth; > var xs = w / _toPrint._width; > var ys = h / _toPrint._height; > trace("page dimensions " + w + ", " + h + " scale " + xs + ", " + > ys + " to print " + _toPrint._xscale + ", " + _toPrint._yscale ); > var _printWidth:Number; > var _printHeight:Number; > var scale:Number = (xs < ys) ? xs : ys; > if (xs < ys) { > _printWidth = Math.floor(xs * _toPrint._width); > _printHeight = Math.floor(xs * _toPrint._height); > } else { > _printWidth = Math.floor(ys * _toPrint._width); > _printHeight = Math.floor(ys * _toPrint._height); > } > trace("to print " + _toPrint._xscale + ", " + _toPrint._yscale + > " = " + _toPrint._width + ", " + _toPrint._height); > // add specified area to print job > //now do our bitmap thingy.. > var printedImg:MovieClip = > this.createEmptyMovieClip("printedImg", this.getNextHighestDepth()); > printedImg.beginFill(0xffffff, 1); > printedImg.moveTo(0, 0); > printedImg.lineTo(my_pj.pageWidth, 0); > printedImg.lineTo(my_pj.pageWidth, my_pj.pageHeight); > printedImg.lineTo(0, my_pj.pageHeight); > printedImg.lineTo(0, 0); > printedImg.endFill(); > var printBmp:BitmapData = new BitmapData(my_pj.pageWidth, > my_pj.pageHeight, false, 0xffffff); > printedImg.attachBitmap(printBmp, 1); > var mtx:Matrix = new Matrix(); > mtx.scale(scale, scale); > printBmp.draw(_toPrint, mtx); > // repeat once for each page to be printed > if (my_pj.addPage(printedImg, null, {printAsBitmap:true})) { > pagesToPrint++; > } > _toPrint._xscale = _toPrint._yscale = 100; > if (pagesToPrint > 0) { > my_pj.send(); // print page(s) > } > printBmp.dispose(); > delete printBmp; > printedImg.unloadMovie(); > > } > > } > > Gert-Jan van der Wel wrote: > >> Hi Jim, >> >> Yeah we tried the printAsBitmap option, but it didn't make much of a >> difference. We're now looking at creating a BitmapData and printing that. >> Maybe that works. >> >> Gert-Jan >> >> >> Op 24 okt 2008, om 15:17 heeft Jim McIntyre het volgende geschreven: >> >> Gert-Jan van der Wel wrote: >>> >>>> Hi there, >>>> We use filters (shadows and glows) to make the scene look better. At >>>> some point a user can print what they've created, but the print shows no >>>> filters. Is there an easy way to get the filters on the print? >>>> >>> >>> Have you tried printAsBitmap? I found that was the only way to get some >>> stuff to print the same way it was displayed, even when filters weren't >>> involved (like some hand-drawn shadows using transparent fills). >>> >>> My project was written in AS2; I don't know whether the implications are >>> different for code running in AVM2. >>> >>> (code simplified from my app, untested) >>> >>> -- >>> >>> private function printPoster():Void { >>> var posterPrintJob:PrintJob = new PrintJob(); >>> if (posterPrintJob.start()) { >>> var pgsQueued:Number = 0; >>> this.printPg._visible = true; //printPg is the MovieClip to print >>> var printArea:Object = {xMin:0, xMax:printPg._width, yMin:0, >>> yMax:printPg._height}; >>> var printOptions:Object = {printAsBitmap:true}; >>> if (posterPrintJob.addPage('printPg', printArea, printOptions)) { >>> pgsQueued++; >>> } >>> if (pgsQueued) { >>> posterPrintJob.send(); >>> } >>> } >>> } >>> >>> -- >>> _______________________________________________ >>> Flashcoders mailing list >>> Flashcoders@chattyfig.figleaf.com >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >>> >> >> _______________________________________________ >> Flashcoders mailing list >> Flashcoders@chattyfig.figleaf.com >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> >> > -- > > Glen Pike > 01326 218440 > www.glenpike.co.uk <http://www.glenpike.co.uk> > > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- Gert-Jan van der Wel Co-Founder & CTO, Floorplanner.com +31 (0)10 281 0799 +31 (0)6 1665 0338 [EMAIL PROTECTED] http://www.floorplanner.com _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders