4 Replies Latest reply on Jun 6, 2008 12:00 PM by AICC

    Flex Printing is horrible

      I have been trying rather unsucessfully for 2 days to print all of the items within a list. After watching a video and waiting for help, Ive come to the conclusion that Flex is not very good for printing.

      I have finally gotten my PrintDataGrid to print except it only prints 2 lines per page. I have changed the rowCount and every other property I can think of to get the darn thing to fill up a page.

      So now, after wasting at least a ream of paper and hours of time for what should be a relatively simple task, Ive come to the conclusion that perhaps Adobe, A PRINTING COMPANY, might want to put a little more effort into the printing aspect of Flex. IT SHOULD NOT BE THIS HARD TO PRINT A LIST OF ITEMS.

      Unfortunately, I dont have the luxury of using the DataGrid because the items are rendered from a component that determines their layout relative to the list. I've tried EVERYTHING I can think of...

      and am just disappointed.
        • 1. Re: Flex Printing is horrible
          shawnyale Level 1
          Here is my code is anyone is interested:

          // Print page function
          public function Print():void{
          var printJob:FlexPrintJob = new FlexPrintJob();
          var printView:PrintAllMeetings = new PrintAllMeetings();

          // Start the print job.
          if (printJob.start() != true) return;
          // Add the PrintAllMeetings object to the application
          // Set the data provider and height / width
          printView.PrintMeetings.dataProvider = lstMeetings.dataProvider;
          printView.width = printJob.pageWidth;
          printView.height = printJob.pageHeight;

          // Add the Print All Meetings object to the print job

          // Loop through all of the items in the list
          // Send the print jbo to the printer
          // Remove the child Print All Meetings object from the application

          And my component PrintDataGrid:
          <mx:PrintDataGrid id="PrintMeetings" width="100%" >
          <mx:DataGridColumn itemRenderer="common.MeetingListItemSmall"/>
          • 2. Flex Printing is horrible
            shawnyale Level 1
            Sorry if I sound crabby, Im just tired of fighting to get this thing to work.

            Im sure it works great if all I had to print was a couple football teams and divisions or something, but I have to print something "real"
            • 3. Re: Flex Printing is horrible

              I've spent full 7 working days trying to figure out how to control the printing. I've found a more or less satisfactory solution but only through a trial and error. There are so many variables that determine how the lists get printed that I cannot begin to imagine how to put it in writing. You should try with assigning various heights to your PrintDataGrids: no height, percent height (you may find that the same job prints OK with 74% but does not print OK with 75%), height in pixels and explicit height. Also font sizes matter. My print, e.g. works with 7 points font, but does not with 8 points. Certain properties fail to get set if you change the font size. But according to the video somebody's "manager is happy". I wrote the same message that for a printing company such as Adobe having printing in Flex at such a low level is a disgrace.

              In your case I would stretch your PrintDataGrid to the edge of the page so that it receives some height in pixels and then see how it works. BTW It would work differently if you'd create you PDG in action script and not MXML.(not necessarily right though, too).
              • 4. Re: Flex Printing is horrible
                What you are suggesting, sounds like a recipe for disastor, if the deployment of the application is to several hundred computers.

                Has anyone come across solutions from flex or another adobe product that will print mulitple pages consistently.
                (with a variant size for row heights or a variation of any of the objects that will plug into the report).

                For example> I tried to print a datagrid that had a variation to row height. Sometime 5 lines of text needs to be printed while other times. 3 lines of text is printed.

                The only thing I could do so that the data grid rows would not "mess up" and print half rows and even skip rows was to make the row-height consistent for every datagrid record..

                <mx:PrintDataGrid id="myDataGrid" rowHeight="220" width="400" wordWrap="true">
                <!-- Specify the columns to ensure that their order is correct. -->
                <mx:DataGridColumn dataField="Index" />
                <mx:DataGridColumn dataField="Qty" />
                <mx:DataGridColumn dataField="QtyDescription" wordWrap="true" width="150"/>

                I also noticed, it is hard to get page x of xx printed at the top or bottom of the page in a page header /page footer.

                Isn't their a simple report writer available for adobe products?
                similar to crystal reports, Microsoft Access reports, SQL Reporting services

                Doug Lubey of Louisiana

                search engine reference:
                adobe flex 3 printing examples