1 Reply Latest reply on Jun 6, 2008 12:13 PM by AICC

    Multiple Page printing in Flex 2

    Navigator35
      Hi All,
      In our recent project using Flex 2 we have a requirement to print user entered data as reports.
      The content length varies highly according to the entered data by user. so it can span more than one page.
      For every page we need to add header and footer. But i dont know by using 'FlexPrintJob' class how do i check it will be printing in one or more than one page. I searched and found PrintDataGrid can tell the number of pages. But i dont have any datagrid in my report page. how do i solve this problem?

      waiting eagerly for the solution from you people. Thanks in advance.
        • 1. Re: Multiple Page printing in Flex 2
          AICC
          The closest thing I came to this is:

          http://livedocs.adobe.com/flex/3/html/help.html?content=printing_3.html
          http://livedocs.adobe.com/flex/3/html/help.html?content=printing_5.html

          But notice: I had problems with the variable row height in the datagrid. The only thing I could do is expand the rowheight to be equal the maximum size I could possilbly images which was 10 lines (rowHeight="320") . But it does not sound like this would work for you.


          ----------------------------------------------------------------
          variable rowheight in the datagrid printing does not work
          reference by me on livedocs:
          ----------------------------------------------------------------
          the example does not work if you have a variable row height in the printed datagrid.

          <mx:PrintDataGrid id="myDataGrid" variableRowHeight="true" sizeToPage="true" >
          <!-- Specify the columns to ensure that their order is correct. -->
          <mx:columns>
          <mx:DataGridColumn dataField="Index" />
          <mx:DataGridColumn dataField="Qty" />
          <mx:DataGridColumn dataField="QtyDescription" wordWrap="true"/>
          </mx:columns>
          </mx:PrintDataGrid>
          In the above example(using pseudocode)> QtyDescription+= "("+Qty+")"

          so in other words: towards the end
          QtyDescription would grow to: (1)(2)(3)(4)(5)(6)....(34)(35)
          if you plugged 35 into the number of rows you wanted to return.

          So printing on the internet for variable row heights or repeaters that have a variable height will become inconsistent. Starting with page2 of the printed report.


          Doug Lubey of Louisiana
          www.DougLubey.com
          ----------------------------------------------------------------
          the only way to fix this is to not use a variable height and keep all the
          rows the same height. Here is how you would do this.

          <mx:PrintDataGrid id="myDataGrid" rowHeight="220" width="400" wordWrap="true">
          <!-- Specify the columns to ensure that their order is correct. -->
          <mx:columns>
          <mx:DataGridColumn dataField="Index" />
          <mx:DataGridColumn dataField="Qty" />
          <mx:DataGridColumn dataField="QtyDescription" wordWrap="true" width="150"/>
          </mx:columns>
          </mx:PrintDataGrid>
          ----------------------------------------------------------------
          FLEX PRINTINg is Difficult:
          it is hard to get page x of xx printed at the top or bottom of the page in a page header

          ----------------------------------------------------------------