Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/01/2013, 12:01
daicrel
 
Fecha de Ingreso: enero-2013
Mensajes: 36
Antigüedad: 11 años, 3 meses
Puntos: 0
Respuesta: Como limitar la datos en un pdf

Cita:
Iniciado por Carlangueitor Ver Mensaje
¿Y cómo estás haciendo el reporte?

Asi

Código PHP:
Ver original
  1. <?php
  2. require('fpdf/fpdf.php');
  3.    
  4. class PDF extends FPDF
  5. {
  6.  
  7.   //Cabecera de página
  8.     function Header()
  9.     {
  10.        
  11.         //Logo
  12.         $this->Image('img/cintillo_inst.jpg',5,5,200);
  13.         //Arial bold 15
  14.         $this->SetFont('Arial','B',14);
  15.         //Movernos a la derecha
  16.         $this->Cell(18);
  17.         //Título
  18.         $this->Cell(170,60,'Reporte de Solicitud de Alimentos',0,0,'C');
  19.        
  20.         $this->SetFont('Arial','',12);
  21.         $this->Line(15,45,201,45);
  22.         $this->Text(18,50,'No.');
  23.         $this->Text(28,50,'Nombres');
  24.         $this->Text(55,50,'Apellidos');
  25.         $this->Text(85,50,'Cargo');    
  26.         $this->Text(120,50,'Gerencia');  
  27.         $this->Line(15,52,201,52);
  28.         $this->Line(15,53,201,53);
  29.         //Salto de línea
  30.         $this->SetY(60);
  31.        
  32.     }
  33.  
  34.     //Pie de página
  35.     function Footer()
  36.     {
  37.      
  38.       //Posición: a 1,5 cm del final
  39.         $this->SetY(-40);
  40.         //Arial italic 8
  41.         $this->SetFont('Arial','I',12);
  42.         //Número de página
  43.         $this->Cell(0,10,'Pagina '.$this->PageNo().'/{nb}',0,0,'C');
  44.         $fecha=date("Y-m-d");
  45.         $hora=date("H:i:s");
  46.         $this->Line(15,241,201,241);
  47.         $this->Line(15,247,201,247);
  48.         $fecha=("Fecha: ").date("Y-m-d");
  49.         $hora=("Hora: ").date("H:i:s");
  50.         $this->Text(18,245.5,$fecha);
  51.         $this->Text(56,245.5,$hora);
  52.         $this->Image('img/pie_pag1.png',21,250,172,21);
  53.        
  54.     }
  55.  
  56.     function __construct()
  57.     {      
  58.         //Llama al constructor de su clase Padre.
  59.         //Modificar aka segun la forma del papel del reporte
  60.         parent::__construct('P','mm','Letter');
  61.     }
  62. }
  63.  
  64.     //Creación del objeto de la clase heredada
  65.     $pdf=new PDF();
  66.     $pdf->SetTopMargin(5.4);
  67.     $pdf->SetLeftMargin(4.5);    
  68.     $pdf->AliasNbPages();
  69.     $pdf->SetFont('Times','',12);
  70.  
  71. $cadconex="dbname=sspa host=localhost port=5432 user=postgres password=0000";
  72. $conexion = pg_connect($cadconex);
  73.  
  74.  
  75.  
  76.  
  77.         $cadbusca = "select nombre, apellido, gerencia, cargo from empleados";
  78.             $result=pg_query($cadbusca) or die('La consulta fallo: ' . pg_last_error());
  79.  
  80.         $j=1;
  81.         $pdf->AddPage();    
  82.        
  83.          while($row = pg_fetch_array($result))
  84.         {
  85.            
  86.         $name = $row["nombre"];            
  87.         $apellidos = $row["apellido"];
  88.         $gerencia = $row["gerencia"];
  89.         $cargo = $row["cargo"];
  90.            
  91.         $pdf->Text(18,$pdf->GetY(),($j));
  92.         $pdf->Text(28,$pdf->GetY(),$name);
  93.         $pdf->Text(55,$pdf->GetY(),$apellidos);
  94.         $pdf->Text(85,$pdf->GetY(),$cargo);
  95.         $pdf->Text(120,$pdf->GetY(),$gerencia);
  96.         $pdf->cell(0,5.5,'',0,1);
  97.         $j=$j+1;
  98.         }
  99.         $pdf->cell(0,10,'',0,1);
  100.         $pdf->Text(162,$pdf->GetY(),'Firma');
  101.         $pdf->cell(0,5,'',0,1);
  102.         $pdf->Text(150,$pdf->GetY(),'_________________');
  103.         $pdf->Output();    
  104. ?>