Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/08/2011, 22:59
Avatar de Briss
Briss
 
Fecha de Ingreso: junio-2011
Mensajes: 1.293
Antigüedad: 12 años, 10 meses
Puntos: 12
Crear una tabla fpdf16

Hola amigos he hecho un pdf desde php pero me gustaria saber q modificar para que los datos me los muestre en una tabla... y agregar un logo en la parte superior hasta ahora solo he logrado mostrar mis registros
Gracias

<?php

require('../fpdf16/fpdf.php');

//Conexion a la bd
include('connection.php');
//Crea un nuevo pdf
//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;

.
.
.

mysql_select_db($database_connection, $connection);
$query_alumnos = sprintf("SELECT *FROM alumnos ORDER BY ApellidoPaterno ASC");
$alumnos = mysql_query($query_alumnos, $connection) or die(mysql_error());


//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($alumnos))
{
//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['rfcalumno'];
$NOMB = $row['Nombre'];
$LIBRE = $row['ApellidoPaterno'];
$LIB = $row['ApellidoMaterno'];

$pdf->SetY($y_axis);
$pdf->SetX($x_axis);


$linea=$CODI." ".$NOMB." ".$LIBRE." ".$LIB;

$pdf->MultiCell(0,6,$linea,0,1,'L',10);
//$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);


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



//Create file

$pdf->Output();
?>