Foros del Web » Programando para Internet » PHP »

FPDF: El Archivo esta dañado y no puede repararse

Estas en el tema de FPDF: El Archivo esta dañado y no puede repararse en el foro de PHP en Foros del Web. Saludos a todos los foristas. Estoy tratando de realizar en reporte con la clase FPDF para u sitio web estadistico corresppondiente a un formato epidemiologico ...
  #1 (permalink)  
Antiguo 04/08/2009, 11:03
 
Fecha de Ingreso: agosto-2009
Mensajes: 1
Antigüedad: 14 años, 8 meses
Puntos: 0
Pregunta FPDF: El Archivo esta dañado y no puede repararse

Saludos a todos los foristas.

Estoy tratando de realizar en reporte con la clase FPDF para u sitio web estadistico corresppondiente a un formato epidemiologico el cual debe ser mostrado en en una tabla de 30 filas y 30 columnas con una cabecera en donde se encontraran grupos etarios y sexo respectivamente. el caso es que al solicitar con $pdf->Output() muestra un mensaje con el texto "El archivo esta dañado y no puede repararse". al experimentar esto he ido disminuyendo filas o grupos etarios en pro de encontrar el problema y noto que cuando las celdas agregadas con $this->Cell() se aproxima a las 300 en una hoja me lanza este error; y si leen bien se necesitarian unas 900.

Basado en esto me pregunto ¿sera que existe alguna restriccion en la cantidad de celdas agregadas a una hoja del documento pdf? ¿Que pued hacer? le agradeceria mucho si alguien puede ayudarme porque el sitio ya esta listo para funcionar solo falta el reporte.

les dejo el codigo para que verifiquen

Código PHP:
require('fpdf/fpdf.php');
include(
'Conexion.php');
class 
PDF extends FPDF
{

    function 
Tabla()
    {
         
$link Conectarse();
       
$consulta "SELECT enfermedades.ORDEN, enfermedades.DESC_ENFER, detalle.COD_ENFER, Sum(detalle.M1) AS SM1, Sum(detalle.F1) AS SF1, Sum(detalle.M2) AS SM2, Sum(detalle.F2) AS SF2, Sum(detalle.M3) AS SM3, Sum(detalle.F3) AS SF3, Sum(detalle.M4) AS SM4, Sum(detalle.F4) AS SF4, Sum(detalle.M5) AS SM5, Sum(detalle.F5) AS SF5, Sum(detalle.M6) AS SM6, Sum(detalle.F6) AS SF6, Sum(detalle.M7) AS SM7, Sum(detalle.F7) AS SF7, Sum(detalle.M8) AS SM8, Sum(detalle.F8) AS SF8, Sum(detalle.M9) AS SM9, Sum(detalle.F9) AS SF9, Sum(detalle.M10) AS SM10, Sum(detalle.F10) AS SF10, Sum(detalle.M11) AS SM11, Sum(detalle.F11) AS SF11, Sum(detalle.M12) AS SM12, Sum(detalle.F12) AS SF12, Sum(detalle.M13) AS SM13, Sum(detalle.F13) AS SF13, Sum(detalle.TM) AS STM, Sum(detalle.TF) AS STF, Sum(detalle.TS) AS STS FROM detalle INNER JOIN enfermedades ON enfermedades.COD_ENFER = detalle.COD_ENFER 
    WHERE (detalle.ANIO='2009') AND (detalle.SEMANA>=29 AND detalle.SEMANA<=29)
    GROUP BY enfermedades.ORDEN, enfermedades.DESC_ENFER
    ORDER BY enfermedades.ORDEN"
;
       
$result mysql_query($consulta,$link);
       while(
$Result=mysql_fetch_assoc($result))
       {       
        
$Datos[$i] = array("Enfermedad" => $Result["DESC_ENFER"], "f1" => $Result["SF1"], "m1" => $Result["SM1"], "f2" => $Result["SF2"], "m2" => $Result["SM2"], "f3" => $Result["SF3"], "m3" => $Result["SM3"], "f4" => $Result["SF4"], "m4" => $Result["SM4"], "f5" => $Result["SF5"], "m5" => $Result["SM5"], "f6" => $Result["SF6"], "m6" => $Result["SM6"], "f7" => $Result["SF7"], "m7" => $Result["SM7"], "f8" => $Result["SF8"], "m8" => $Result["SM8"], "f9" => $Result["SF9"], "m9" => $Result["SM9"], "f10" => $Result["SF10"], "m10" => $Result["SM10"], "f11" => $Result["SF11"], "m11" => $Result["SM11"], "f12" => $Result["SF12"], "m12" => $Result["SM12"],  "f13" => $Result["SF13"], "m13" => $Result["SM13"], "tf" => $Result["STF"],"tm" => $Result["STM"],"ts" => $Result["STS"]);
        
$i++;
        }
            
$reg 0;
            foreach(
$Datos as $row)
            {
            
$this->Ln();
            
$reg++;
            if(
$reg <=30)
            {
                
$this->SetFont('Arial','B',7);
                
$this->Cell(70,4,$row["Enfermedad"],'LTRB','','L');
                
$this->SetFont('Arial','',7);
                
$this->Cell(9,4,$row["f1"],'LTRB','','R');
                
$this->Cell(9,4,$row["m1"],'LTRB','','R');
                
$this->Cell(9,4,$row["f2"],'LTRB','','R');
                
$this->Cell(9,4,$row["m2"],'LTRB','','R');
                
$this->Cell(9,4,$row["f3"],'LTRB','','R');
                
$this->Cell(9,4,$row["m3"],'LTRB','','R');
                
$this->Cell(9,4,$row["f4"],'LTRB','','R');
                
/*$this->Cell(9,4,$row["m4"],'LTRB','','R');
                $this->Cell(9,4,$row["f5"],'LTRB','','R');
                $this->Cell(9,4,$row["m5"],'LTRB','','R');
                $this->Cell(9,4,$row["f6"],'LTRB','','R');
                $this->Cell(9,4,$row["m6"],'LTRB','','R');
                $this->Cell(9,4,$row["f7"],'LTRB','','R');
                $this->Cell(9,4,$row["m7"],'LTRB','','R');
                $this->Cell(9,4,$row["f8"],'LTRB','','R');
                $this->Cell(9,4,$row["m8"],'LTRB','','R');
                $this->Cell(9,4,$row["f9"],'LTRB','','R');
                $this->Cell(9,4,$row["m9"],'LTRB','','R');
                $this->Cell(9,4,$row["f10"],'LTRB','','R');
                $this->Cell(9,4,$row["m10"],'LTRB','','R');
                $this->Cell(9,4,$row["f11"],'LTRB','','R');
                $this->Cell(9,4,$row["m11"],'LTRB','','R');
                $this->Cell(9,4,$row["f12"],'LTRB','','R');
                $this->Cell(9,4,$row["m12"],'LTRB','','R');
                $this->Cell(9,4,$row["f13"],'LTRB','','R');
                $this->Cell(9,4,$row["m13"],'LTRB','','R');
                $this->Cell(10,4,$row["tf"],'LTRB','','R');
                $this->Cell(10,4,$row["tm"],'LTRB','','R');
                $this->Cell(10,4,$row["ts"],'LTRB','','R');*/
                
if($reg ==30)
                {
                    
$this->AddPage('l'legal);
                    
$reg 0;
                }
            }            
            }
// fin for $j
    
}//fin funcion Tabla
    
function Header()
    {
         
//Logo
        //$this->Image('Imagenes/Mac-Logo.png',10,15,150,100);
        //Arial bold 15
        
$this->SetFont('Arial','B',10);
        
//Movernos a la derecha
        
$this->Cell(0,5,'DIRECCION REGIONAL DE EPIDEMIOLOGIA ESTADO ZULIA','','','C');
        
$this->Ln();
        
$this->Cell(0,5,'SECRETARIA DE SALUD DEL PODER EJECUTIVO DEL ESTADO ZULIA','','','C');
        
$this->Ln();
        
$this->Cell(0,5,'EPI-12 REGISTRO SEMANAL DE ENFERMEDADES DE NOTIFICACIÓN OBLIGATORIA','','','C');
        
$this->Ln();
        
$this->Ln();
      
        
//Títulos de las columnas
    
$header=array('Enfermedades de Notificación','< 1 año','1 - 4 a.','5 - 6 a.''7 - 9 a.''10 - 11 a.''12 - 14 a.''15 - 19 a.''20 - 24 a.''25 - 44 a.''45 - 59 a.''60 - 64 a.''65 a. y+''IGN''TOTALES''F''M''F''M''F''M''F''M''F''M''F''M''F''M''F''M''F''M''F''M''F''M''F''M''F''M''TF''TM''TG');
        
//Cabecera
        
$i 0;
        foreach(
$header as $col)
        {
            if(
$i == 0)
            {
                
$this->SetFont('Arial','b',12);
                
//$this->SetTextColor(25,30,150);
                
$this->Cell(70,5,$col,'LTR','','C');
                
//$this->Ln();
                
$i++;
            }
            elseif(
$i <= 13)// Para Grupos etarios
            
{
                
$this->SetFont('Arial','b',10);
                
$this->Cell(18,5,$col,1,'','C');
                
$i++;
                
//$this->Ln();
            
}
            elseif(
$i == 14)
            {
                
$this->Cell(30,5,$col,1,'b','C');
                
$this->Ln();
                
$i++;
            }
            elseif(
$i >= 15 && $i <= 40 )// Para el sexo
            
{
                
$this->SetFont('Arial','b',10);
                if(
$i == 15)
                {
                    
$this->SetFont('Arial','b',12);
                    
$this->Cell(70,5,'Obligatoria','LBR','','C');
                    
$this->SetFont('Arial','b',10);
                    
$this->Cell(9,5,$col,1,'','C');
                    
$i++;
                }
                else
                {
                    
$this->SetFont('Arial','b',10);
                    
$this->Cell(9,5,$col,1,'','C');
                    
$i++;
                }
            }
            else
            {
                
$this->Cell(10,5,$col,1,'','C');
                
$i++;
            }
        }
    }
}
$pdf=new PDF('L''mm'Legal);
$pdf->SetAutoPageBreak(false);
$pdf->SetFont('Arial','',12);
$pdf->AddPage('L'Legal);
$pdf->Tabla();
$pdf->Output(); 
podran notar en el codigo que hay un bloque de lineas que estan comentadas, es precisamente haste ese bloque lo que me muestra, si le habilito una linea mas comienza el mensaje antes mencionado

Espero su ayuda...

Ing. Christopher Chacon
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:36.