Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/01/2012, 18:10
yamsita
 
Fecha de Ingreso: diciembre-2011
Mensajes: 90
Antigüedad: 12 años, 4 meses
Puntos: 0
reporte PDF con mysql y fpdf

bien dia!

tengo un pequeño problema con fpdf. Les comento mi problema.

estoy realizando una consulta mysql con php y necesito crear un PDF con fpdf, y todo se realiza correctamente pero el problema es que el PDF me amontona los resultados, quisiera ver si pudieran ayudarme, les dejo el codigo, muchas gracias!

Código PHP:
//Crea un nuevo pdf
$pdf=new FPDF();

//Disable automatic page break
$pdf->SetAutoPageBreak(true);

//Añade primera página
$pdf->AddPage();

//seteo inicial de margenes y position axis pr pagina
$y_axis_initial 0;
$x_axis 10;
$y_axis 20;

//imprime los titulos de columna para la pagina (quitar comentarios para activar)
$pdf->SetFillColor(232,232,232);
$pdf->SetFont('Arial','B',10);
$pdf->SetY($y_axis_initial);
//$pdf->Cell(30,6,'CODI',1,0,'L',1);
$y_axis $y_axis $row_height;
//Hago una query a mi bd
$result=@mysql_query('SELECT * FROM Proveedor_DG',$conexion);
//inicializo el contador
$i 0;
//Seto el maximo de filas por pagina
$max 25;
//Seteo la altuira de la fila
$row_height 6;
while(
$row =@mysql_fetch_array($result))
{
//Si la fila actual es la ultima, creo una nueva página e imprimo el titulo (quitar comentarios para activar)
if ($i == $max)
{
$pdf->AddPage();
//print column titles for the current page
//$pdf->SetY($y_axis_initial);
//$pdf->SetX(25);
//$pdf->Cell(30,6,'CODI',1,0,'L',1);

//Go to next row
$y_axis $y_axis $row_height;
//Set $i variable to 0 (first row)
$i 0;
}
$CODI $row['Id'];
$NOMB $row['Id_usuario'];
$LIBRE $row['Empresa'];
$RFC $row['RFC'];

$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$linea=$CODI.$NOMB.$LIBRE;
$pdf->Cell(0,6,'Uno: '.$CODI,0,1);
$pdf->Cell(0,6,'Otro: '.$NOMB,0,1);
$pdf->Cell(0,6,'RFC: '.$RFC,0,1);
$pdf->Ln(30);
//$pdf->MultiCell(30,6,$CODI,0,0,'L',0);
//$pdf->MultiCell(90,6,$NOMB,0,0,'Ln',0);
//$pdf->MultiCell(120,6,$LIBRE,0,0,'Ln',0);
//$pdf->Ln(5);
//$pdf->MultiCell(0,6,$row['Id'],0,1,'L',10);
//$pdf->Ln(5);
//$pdf->MultiCell(0,6,$row['Id_usuario'],0,1,'L',10);
//$pdf->Ln(5);
//$pdf->MultiCell(0,6,$row['Empresa'],0,1,'L',10);

//Go to next row
$y_axis $y_axis $row_height;
$i++;
}

mysql_close($conexion);

//Create file
$pdf->Output(); 
Muchas gracias!