0 Replies Latest reply on Sep 23, 2006 9:58 AM by flashStream

    Need Help about PrintJob from ScrollPane Content

    flashStream
      Hi Everybody,

      I'm developing a Flash Application which helps to create Catalog Building like FlipBook. Where I am using ScrollPane to hold the content of the catalog. I mean it contains number of pages depends on the catalog. Here I need to provide Print option. Where user can select Range of pages (print from page to page) by providing two dropdown boxes one is for from and the other is for to selections. Presently I am able to print the scrollPane content using attached script. But the problem is the output of printJob is not exactly fit to the complete page.

      I'm able to solve the above issue by loading the external swf file into the main swf file. But here the problem is the catalog contains hundread's of pages which are at high resolution. So if I have to load the entire swf file for every print request given by user(even for a single page print).

      could anybody please suggest me to solve this issue. Its a bit urgent. please llok at the attached code.

      Thanks in Advance
      // This code is giving problem with fit to page in print output

      function printProc() {
      var numPages:Number = int(_global.StartPage);
      var my_pj:PrintJob = new PrintJob();
      if (my_pj.start()) {
      for (i=numPages; i<=int(_global.EndPage); i++) {
      var page_mc = _root.mySP.spContentHolder.myBook.getPageLink(i); var parent = page_mc._parent._parent;
      var visible = parent._visible;
      if (!visible) {
      parent._visible = true;
      }
      if (page_mc && my_pj.addPage(page_mc, {xMin:0, xMax:800, yMin:0, yMax:970}, null, i)) {
      numPages++;
      }
      }
      if (numPages>0) {
      my_pj.send();
      }
      if (!visible) {
      parent._visible = false;
      }
      }
      delete my_pj;
      }
      print_mc.doPrint_btn.onRelease = function() {
      printProc();
      hideAllWindows();
      };
      // ******************************************************************* //

      // This is also working fine but problem with loading exterbal swf everytime for each request

      function printProc() {
      _root.createEmptyMovieClip("printNew_mc", 0);
      _root.printNew_mc._x = -1000;
      var mclListener:Object = new Object();
      var numPages:Number = int(_global.StartPage);
      mclListener.onLoadInit = function(target_mc:MovieClip) {
      printNew_mc._visible = false;
      var my_pj:PrintJob = new PrintJob();
      var bPrintInit:Boolean = my_pj.start();
      if (bPrintInit) {
      for (i=numPages; i<=int(_global.EndPage); i++) {
      var npageWidth:Number = my_pj.pageWidth;
      var npageHeight:Number = my_pj.pageHeight;
      var mcProps:Object = {width:_root.printNew_mc._width, height:_root.printNew_mc._height};
      with (_root.printNew_mc) {
      _width = npageWidth;
      _height = npageHeight;
      }
      my_pj.addPage(_root.printNew_mc, {xMin:0, xMax:800, yMin:0, yMax:970}, null, i);
      }
      my_pj.send();
      with (_root.printNew_mc) {
      _width = mcProps.width;
      _height = mcProps.height;
      }
      _root.printNew_mc.removeMovieClip();
      }
      };
      var image_mcl:MovieClipLoader = new MovieClipLoader();
      image_mcl.addListener(mclListener);
      image_mcl.loadClip("print.swf", printNew_mc);
      }

      print_mc.doPrint_btn.onRelease = function() {
      printProc();
      hideAllWindows();
      };

      // **************************************************************//