protected function btn_clickHandler(event:MouseEvent):void
{
pdfListadoVentas = new PDF(Orientation.PORTRAIT, Unit.POINT, Size.LETTER );
//pdfListadoVentas.setDisplayMode(Display.FULL_PAGE,Layout.SINGLE_PAGE);
pdfListadoVentas.addPage();
//Borde
pdfListadoVentas.lineStyle ( new RGBColor ( 0x0000CD ), .5, 0, 1, CapsStyle.SQUARE, JointStyle.BEVEL );
pdfListadoVentas.drawRect(new Rectangle ( 20, 20, 570, 750 ));
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 20);
pdfListadoVentas.addText("Listado de Ventas",225,50);
//Linea1
pdfListadoVentas.drawRect(new Rectangle ( 20, 60, 570, 1 ));
// Boletas fecha
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 12);
pdfListadoVentas.addText("BOLETAS",30,75);
//Desde
pdfListadoVentas.addText("Desde: ",200,75);
//Hasta
pdfListadoVentas.addText("Hasta: ",380,75);
//Linea2
pdfListadoVentas.drawRect(new Rectangle ( 20, 80, 570, 1 ));
// Header Text
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 15);
pdfListadoVentas.addText("Fecha",60,100);
pdfListadoVentas.addText("Nº Boleta",130,100);
pdfListadoVentas.addText("Clientes",225,100);
pdfListadoVentas.addText("Rut",360,100);
pdfListadoVentas.addText("Contrato",430,100);
pdfListadoVentas.addText("Total",500,100);
//Linea3
pdfListadoVentas.drawRect(new Rectangle ( 20, 725, 570, 1 ));
// Total
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 14);
pdfListadoVentas.addText("CANTIDAD DE BOLETAS: ",30,750);
pdfListadoVentas.addText("TOTAL BOLETAS: ",380,750);
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 10);
//Que array tomar, segun RadioButtons
if(rbHoy.selected == true){
for(var i:int=0; i<reporteHoy.length; i++)
{
//Array
pdfListadoVentas.addText(this.reporteHoy[i].fechaEmision, 60, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].numBoleta, 150, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].nombre, 210, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].rut, 360, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].numContrato, 450, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].abono, 500, 130+(i*15));
}
pdfListadoVentas.save(Method.REMOTE, "http://localhost/amfphp/services/sevelec/create.php", Download.INLINE, "listadoVentas.pdf");
}
else if(rbOtraFechas.selected == true){
for(var i:int=0; i<reporteOtraFecha.length; i++)
{
//Array
pdfListadoVentas.addText(this.reporteOtraFecha[i].fechaEmision, 60, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].numBoleta, 150, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].nombre, 210, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].rut, 360, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].numContrato, 450, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].abono, 500, 130+(i*15));
if(i == 39){
var i2:int = 40;
pdfListadoVentas.addPage();
//Borde
pdfListadoVentas.lineStyle ( new RGBColor ( 0x0000CD ), .5, 0, 1, CapsStyle.SQUARE, JointStyle.BEVEL );
pdfListadoVentas.drawRect(new Rectangle ( 20, 20, 570, 750 ));
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 20);
pdfListadoVentas.addText("Listado de Ventas",225,50);
//Linea1
pdfListadoVentas.drawRect(new Rectangle ( 20, 60, 570, 1 ));
// Boletas fecha
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 12);
pdfListadoVentas.addText("BOLETAS",30,75);
//Desde
pdfListadoVentas.addText("Desde: ",200,75);
//Hasta
pdfListadoVentas.addText("Hasta: ",380,75);
//Linea2
pdfListadoVentas.drawRect(new Rectangle ( 20, 80, 570, 1 ));
// Header Text
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 15);
pdfListadoVentas.addText("Fecha",60,100);
pdfListadoVentas.addText("Nº Boleta",130,100);
pdfListadoVentas.addText("Clientes",225,100);
pdfListadoVentas.addText("Rut",360,100);
pdfListadoVentas.addText("Contrato",430,100);
pdfListadoVentas.addText("Total",500,100);
//Linea3
pdfListadoVentas.drawRect(new Rectangle ( 20, 725, 570, 1 ));
// Total
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 14);
pdfListadoVentas.addText("CANTIDAD DE BOLETAS: ",30,750);
pdfListadoVentas.addText("TOTAL BOLETAS: ",380,750);
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 10);
/*
for(i2; i2<reporteOtraFecha.length; i2++)
{
//Array
pdfListadoVentas.addText(this.reporteHoy[i2].fechaEmision, 60, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].numBoleta, 150, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].nombre, 210, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].rut, 360, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].numContrato, 450, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].abono, 500, 130+(i2*15));
}
//break;*/
}
}
pdfListadoVentas.save(Method.REMOTE, "http://localhost/amfphp/services/sevelec/create.php", Download.INLINE, "listadoVentas.pdf");
}
Como se puede ver, cuando el array llega a 39, genero la otra pagina, y la idea es seguir insertando los demas registros en la otra pagina.