5 Replies Latest reply on Oct 8, 2007 12:08 PM by kglad

    Print page scaled to paper size??

    abeall Level 3
      This is such a simple task, yet I can't seem to figure it out! I'm using AS3 but I think it's the same in AS2. Here's the dilema:

      I have an element which is about 14th the size of the Stage. I would like to provide a button which prints it, isolated, fullscreen. So the answer is to intialize a PrintJob, resize to fill page, print, resize back to original size. Simple enough, but the problem is despite the implication in the documentation I can't seem to resize my object before it gets sent to the printer. The resizing seems to only take affect after the PrintJob is sent. Here's my code(some object names changed for clarity out of context):

      private function printClick():void{
      var pj:PrintJob = new PrintJob();
      myMovieClip_mc.width = pj.pageWidth;
      myMovieClip_mc.height = pj.pageHeight;
      // failed to print

      As you can see, I'm not actually setting the size back to normal, this way I can verify the resizing is actually working, and it is -- after the PrintJob is sent. The printed out paper always prints with the old(wrong) size, whatever that might be. So, I look at the example of "scaling before printing" and find this:
      http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Live Docs_Book_Parts&file=20_Printing_177_7.html

      But, notice how the set text.scaleX and scaleY *before* the PrintJob.start() call? Well, that's useless, because PrintJob.pageWidth and PrintJob.pageHeight is not set until after a call to PrintJob.start(). What do I do? Surely someone has had to print a page that fits in some way to the user's printer???