Thanks to everyone for the help on the print problem. I will try out your
suggestions though I have as a temporary measure just written the text to a
text file and immediately opened it. That way it can then be printed using
the default print functionality of the text editing app.

 

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Anthony DeBonis
Sent: 03 December 2007 17:42
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] Re: Printing a large string over multiple pages

 

Here is some code we use to slice up a long list and print on X# of 
pages. You should be able to do somethink like this...
Hope the code gets formated ok

// Add 2nd page displaying names of selected organizations
var selectedOrgList:List = new List();
selectedOrgList.setActualSize(printJob.pageHeight, 
printJob.pageWidth);
selectedOrgList.setStyle("fontSize","8");
//selectedOrgList.dataProvider = orgList.selectedItems;
var facilitiesPerPage:int = RECORDS_PER_PAGE;
if (printJob.pageHeight < printJob.pageWidth)
{ //height is less than width so we are in landscape mode and 
can't fit as many records per page
facilitiesPerPage = LS_RECORDS_PER_PAGE;
}
selectedOrgList.rowCount = facilitiesPerPage;

var pageCount:int = Math.ceil(orgList.selectedItems.length / 
facilitiesPerPage) ;

var printFacilityViewHolder:Array = new Array();
chartTitle = chartTitle + "\nFacility List";
var sortedOrgs:Array = orgList.selectedItems;
sortedOrgs.sortOn("name");
for (var loopCtr:int = 0; loopCtr < pageCount; loopCtr++) {
var pfv:PrintFacilityView = new PrintFacilityView();
addChild(pfv);
pfv.setDimensions(printJob.pageHeight, printJob.pageWidth);
var startIndex:int = facilitiesPerPage * loopCtr;
var endIndex:int = facilitiesPerPage * (loopCtr + 1);
var pagedOrgList:Array = 
sortedOrgs.slice(startIndex, endIndex);
selectedOrgList.styleName = "facilityListStyle";
selectedOrgList.dataProvider = pagedOrgList;
selectedOrgList.labelField = "name";

pfv.facilityListView.addChild(selectedOrgList);
pfv.setChartTitle(chartTitle + " (" + (loopCtr + 1) + " of " 
+ pageCount + ")"); 
printFacilityViewHolder[loopCtr] = pfv;
printJob.addObject(pfv, FlexPrintJobScaleType.MATCH_WIDTH);
} 
//And send the job to the printer.
printJob.send(); 
//make the print view invisible then remove it
printView.visible = false;

//ATD 10/23/2006 changed to call removeChild from 
printView.facilityListView not printView....
for (loopCtr = 0; loopCtr < pageCount; loopCtr++) {
removeChild(printFacilityViewHolder[loopCtr]);
} 

removeChild(printView);
//selectedOrgList.visible = false;
//restore the regionChartStack to its original condition
restoreStack(chartSwitch, stackSelected);

 

Reply via email to