With the following code, I get a blank 2nd page and the data continues on the 
3rd page.   This code is slightly different from prior example...grasping at 
straws without clear understanding of what I'm doing.

                  private function print():void             {
                        var printJob:FlexPrintJob = new FlexPrintJob();

                        if(printJob.start()){//start the print job
                              printJob.addObject(printcontainer);
                              var validNextPage = printDataGrid.validNextPage; 
//use local var to help debug
                              if (validNextPage) { //worst case scenario two 
pages max
                                    printDataGrid.nextPage();
                                    printDataGrid.validateNow();
                                    printJob.addObject(printcontainer); //get 
blank 2nd page, remaining data on 3rd page
                                    //printJob.addObject(printDataGrid); //2nd 
page blank; 3rd page purple header but no data.
                              }
                              printJob.send();
                              printDataGrid.dataProvider = Appointments;
                        }
                  }
<!-I tried reducing height of VBox and that just caused the page break to 
happen sooner, still had blank 2nd page -->


      <mx:VBox id="printcontainer"  width="100%" height="1450"  
backgroundAlpha="1.0" backgroundColor="white"
                  paddingLeft="20" paddingRight="20" paddingTop="50"
                  borderThickness="20" verticalAlign="top" 
horizontalAlign="center"
                  visible="false"  includeInLayout="false">
            <mx:Label fontSize="24"  textAlign="center"   fontWeight="bold"
                          text="{picker.selectedItem.nickname} on 
{String(Globals.SelectedDate).substr(0,10)}.      This contains PHI; destroy 
after use!!!"
                          />

            <mx:PrintDataGrid  id="printDataGrid" dataProvider="{Appointments}" 
fontSize="12"   >
                  <mx:columns>
                        <mx:DataGridColumn  headerText="Start"   
dataField="starttime" width="80" textAlign="right"/>
                        <mx:DataGridColumn  headerText="Until"   
dataField="endtime" width="80" textAlign="right"/>
                        . . .
                        <mx:DataGridColumn headerText="Location"   
dataField="location"   textAlign="center"/>
                        <mx:DataGridColumn headerText="Notes"   
dataField="notes"  width="400"   textAlign="left"/>
                  </mx:columns>
            </mx:PrintDataGrid>
      </mx:VBox>

From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf 
Of Alex Harui
Sent: Thursday, September 06, 2012 11:50 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] need some printing advice



What result do you get?  No second page or second page is same as first?  If 
the latter, try calling validateNow() after nextPage()


Reply via email to