Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/04/2012, 10:12
luisinho69
 
Fecha de Ingreso: febrero-2010
Mensajes: 16
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: Crear varios archivos PDF con FPDF en PHP

Muchas Gracias por la pronta respuesta.

Sigo aun sin entender (no he dormido ) hehehe...

A ver como haria para crear una instancia para cada PDF, la verdad es que no lo veo, si me pudieras dar un ejemplo estaria muy agradecido.


El codigo como lo tengo en este momento funcionando:
Código PHP:
<?php
require('FPDF/fpdf.php');
include_once(
"conexion.php");
session_start();
$usuario$_SESSION['usuario'];

class 
PDF extends FPDF
{
//Cargar los datos



//Una tabla más completa
function ImprovedTable($header)
{

                        
    
//Anchuras de las columnas
    
$w=array(25,25,20,25,35,20,12,20);
    
$consultadel2"SELECT * FROM organizar_datos GROUP BY `strSubCta`";
                        
$resultadodel2mysql_query($consultadel2);
                        
$filadel12mysql_num_rows($resultadodel2);
                        while (
$filadel2mysql_fetch_array($resultadodel2))
                        {    
    
//Cabeceras
    
for($i=0;$i<count($header);$i++)
        
$this->Cell($w[$i],8,$header[$i],1,0,'C');
    
$this->Ln();
    
//Datos
    
                        
                        
                        
                        
$consultadel"SELECT * FROM organizar_datos where strSubCta=$filadel2[2] and strCallType='R' order by strNumAsociado";
                        
$resultadodelmysql_query($consultadel);
                        while (
$filadelmysql_fetch_array($resultadodel))
                        {
                        
$this->Cell($w[0],6,$filadel[16],'LR');
                        
//$this->Cell($w[0],6,$filadel[0],'LR');
                        
$this->Cell($w[1],6,$filadel[6],'LR');
                        
$this->Cell($w[2],6,$filadel[7],'LR');
                        
$this->Cell($w[3],6,$filadel[8],'LR');
                        
$this->Cell($w[4],6,$filadel[9],'LR');
                        
$this->Cell($w[5],6,$filadel[10],'LR');
                        
$this->Cell($w[6],6,$filadel[11],'LR');
                        
$this->Cell($w[7],6,$filadel[12],'LR');
                        
$this->Ln();
                        
                        }
                    
//Línea de cierre
                        
$this->Cell(array_sum($w),0,'','T');
                        
$this->Ln();
                        
$this->AddPage();
                        }
    
        
    
}


}


//Consulta para varios

                        
                        



$pdf=new PDF();
//Títulos de las columnas
$header=array('Num Asoc','Fecha','Hora','Num Dest','Destino','Duracion','Tarifa','Monto Bs.');
//Carga de datos

$pdf->SetFont('Arial','',12);
$pdf->AddPage();
$pdf->ImprovedTable($header);
$pdf->Output("PDF/PDF3M.pdf");


?>
Saludos cordiales.

Última edición por luisinho69; 18/04/2012 a las 10:15 Razón: añadir codigo