1 Reply Latest reply on Jan 26, 2013 9:23 PM by Flex harUI

    Scrollrect and resizing the object to print

    deepinus

      I have a big gantt chart that I want to print using FlexPrintJob. As we are using flex 3 and IBM gantt chart older version of resource charts which does not support multipage printing, so I am developing my own print fuctionality for this. I am able to print the chart using FlexPrintJOb class. To achieve multipage output, I am using the following code.

       

      for(var i:int=0;i<noofpages;i++){

       

                                                                  printView.scrollRect=new Rectangle(i*printJob.pageWidth,0,(i+1)*(printJob.pageWidth),printJob.pageHeight);

       

       

                                                                  printJob.addObject(printView);

       

       

                                                        }

       

      where printView contains the resource chart to print.

       

      The reuirement is to print the chart in such a way that there should be no column cutting of across the pages i.e. no column should cutoof at the end of page and spread to next page. All the pages should end with a whole column printed. So, I am trying to change the code to somethign like this.

       

      for(var i:int=0;i<noofpages;i++){

      if(i==0) //for first page print first 7 columns so that 7*columnWidth< printJOb.pageWidth

       

      printView.scrollRect=new Rectangle(0,0,7*columnWidth,printJob.pageHeight);

       

      if(i==1) //for second page print  next 7 columns

       

      printView.scrollRect=new Rectangle(7*columnWidth,0,14*columnWidth,printJob.pageHeight);

       

      and so on....

       

      This works fine but there is always a blank area at the end of page since 7*columnWidth< printJOb.PageWidth and if I try to adjust 8 columns in a pge he 8th column runs out of the page. So, In order to fill the blank space in the page I tried to extend the width of the columns by setting the up the width of printView i.e.

       

      if(i==0) //for first page print first 7 columns so that 7*columnWidth< printJOb.pageWidth

      printView.width=7*columnWidth; //added to fill the blank space available in the page since 7*columnWidth<printJob.PageWidth

      printView.scrollRect=new Rectangle(0,0,7*columnWidth,printJob.pageHeight);

       

      Now as is etup the page Width, the page height also automatically extended. Now rows start runnign to the next page.

       

      Is there a way that we can keep the height of the objext same but just change the width of the object??

       

      Please help soon