============================This code produces blank 2nd and 4th page with 
remainder on third page=================
                        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();
                                    printcontainer.validateNow();
                                    printJob.addObject(printcontainer); //get 
blank 2nd page, remaining data on 3rd page
                              }
                              printJob.send();

replacing printcontainer.validateNow()
with           printDataGrid.validateNow()   produces the same result
removing all calls to .validateNow() produces the same result.
Removing the call to .nextPage()  results in printing the contents of the 1st 
page on the third page with 2nd and 4th pages blank

I'm doing a print to Adobe PDF and if I change the paper size to legal, I get 
the same results just with more white space at the bottom of 1st and 3rd pages.

I switched to Foxit Phantom Printer with same result.

It's as if there is an invisible footer on the container or datagrid that force 
a blank page?  It's almost as if there is something in the MXML that is forcing 
a blank 2nd page




From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf 
Of Alex Harui
Sent: Friday, September 07, 2012 11:43 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] need some printing advice



Try calling vlidateNow on printContainer instead of printDataGrid


On 9/7/12 11:19 AM, "Sells, Fred" <fred.se...@adventistcare.org> wrote:





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()






--
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui

Reply via email to