4 Replies Latest reply on Jun 2, 2009 3:38 AM by _Natasha_

    print job gone wrong !!!!!!!!!!!!!!!!

    nikos101 Level 2

      If I try to do a print job like so in a canvas child of a view stack:

       

      adgPrint is a advanced datagird

       

          var printJob:FlexPrintJob = new FlexPrintJob();
           printJob.start();
           printJob.addObject(adgPrint, FlexPrintJobScaleType.MATCH_WIDTH);
          printJob.send();

       

       

      if adgPrint is in a different canvas to the the one that is currently visible I get sheets of paper from the printer that are completly black.

       

      if

       

          var printJob:FlexPrintJob = new FlexPrintJob();
            printJob.start();
            printJob.addObject(adgPrint, FlexPrintJobScaleType.MATCH_WIDTH);
           printJob.send();

       

       

      is called when the canvas in the viewstack (containing the adgPrint )  is selected the thing prints out fine

       

      strange

        • 1. Re: print job gone wrong !!!!!!!!!!!!!!!!
          _Natasha_ Level 4

          Hi,

          Flash prints only visible data, only what is visible for user. It's an optimization. In viewStack invisible parts creates only on the first calling.

          So if you want to print invisible part you should set it visible, print and on end printing (there is an event for this) restore all visible part to old view. It's absolutely invisible for user, I've checked it.

          • 2. Re: print job gone wrong !!!!!!!!!!!!!!!!
            nikos101 Level 2

            Thanks, not the way I like to do things but works fine never the less

            • 3. Re: print job gone wrong !!!!!!!!!!!!!!!!
              nikos101 Level 2

              Thanks I've done this:

               

                                  var printJob:FlexPrintJob = new FlexPrintJob();
                                  printJob.start();
                                  adgPrint.visible = true;
                                  printJob.addObject(adgPrint, FlexPrintJobScaleType.MATCH_WIDTH);
                                  printJob.send();
                                  adgPrint.visible = false;

               

              If they print, it works fine. However if they cancel the print dialoge they get the following error:

               

              ArgumentError: Error #2004: One of the parameters is invalid.
                  at flash.display::Graphics/drawRect()
                  at mx.controls.advancedDataGridClasses::AdvancedDataGridHeaderRenderer/updateDisplayList()[C :\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\advancedDataGridClas ses\AdvancedDataGridHeaderRenderer.as:705]
                  at mx.core::UIComponent/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:6351]
                  at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:622]
                  at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:695]
                  at mx.managers::LayoutManager/validateNow()[C:\autobuild\3.2.0\frameworks\projects\framework \src\mx\managers\LayoutManager.as:748]
                  at mx.printing::FlexPrintJob/addObject()[C:\autobuild\3.2.0\frameworks\projects\framework\sr c\mx\printing\FlexPrintJob.as:456]

               

               

              Any ideas what happened?

              • 4. Re: print job gone wrong !!!!!!!!!!!!!!!!
                _Natasha_ Level 4

                Hi,

                 

                you should check that user don't cancel printing!

                 

                                    var printJob:FlexPrintJob = new FlexPrintJob();

                                   if (printJob.start())

                                    {
                                         adgPrint.visible = true;

                                         printJob.addObject(adgPrint, FlexPrintJobScaleType.MATCH_WIDTH);

                                         printJob.send();

                                         adgPrint.visible = false;

                                    }