<?php
require ('fpdf/fpdf.php');
class PDF extends FPDF
{
//Cabecera de página
   function Header()
   {
    //Logo
    //$this->Image('D:/wamp64/www/ProyectoFPDF/tutorial/logo.png' , 10 ,8, 35 , 38 , “PNG' ,'https://telesupfpdf.wordpress.com/&#8217;);
    //Arial bold 15
    $this->SetFont('Arial','B',15);
    //Movernos a la derecha
    $this->Cell(80);
    //Título
    $this->Cell(60,10,'TABLA EN PDF',1,0,'C');
    //Salto de línea
    $this->Ln(20);
   }
   //Pie de página
   function Footer()
   {
    //Posición: a 1,5 cm del final
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',8);
    //Número de página
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
   }
   //Tabla simple
   function TablaSimple($header)
   {
    //Cabecera
    foreach($header as $col)
        if($col<>'Email'){
            $this->Cell(40,7,$col,1);
        }else
        {
            $this->Cell(75,7,$col,1);
        }
    $this->Ln();
    $this->Cell(40,5,'Giampierre',1);
    $this->Cell(40,5,'Calderon',1);
    $this->Cell(40,5,'931098780',1);
    $this->Cell(75,5,'giam_calderon@hotmail.com',1);
    $this->Ln();
    $this->Cell(40,5,'Carlos',1);
    $this->Cell(40,5,'Paredes',1);
    $this->Cell(40,5,'955738051',1);
    $this->Cell(75,5,'thin85@hotmail.com',1);
    $this->Ln();
    $this->Cell(40,5,'Segundo',1);
    $this->Cell(40,5,'Diaz',1);
    $this->Cell(40,5,'985770982',1);
    $this->Cell(75,5,'vidaldiazc@msn.com',1);
    $this->Ln();
    $this->Cell(40,5,'Jose',1);
    $this->Cell(40,5,'Peche',1);
    $this->Cell(40,5,'987531216',1);
    $this->Cell(75,5,'jopebal@gmail.com',1);
    $this->Ln();
    $this->Cell(40,5,'Jose',1);
    $this->Cell(40,5,'LLontop',1);
    $this->Cell(40,5,'953977249',1);
    $this->Cell(75,5,'crismareniec@gmail.com',1);
   }
 //Tabla coloreada
function TablaColores($header)
{
//Colores, ancho de línea y fuente en negrita
$this->SetFillColor(255,0,0);
$this->SetTextColor(255);
$this->SetDrawColor(128,0,0);
$this->SetLineWidth(.3);
$this->SetFont('Arial','B',9);
//Cabecera
for($i=0;$i<count($header);$i++)
    if($i<3){
        $this->Cell(40,7,$header[$i],1,0,'C',1);
    }else {
        $this->Cell(75,7,$header[$i],1,0,'C',1);
    }
$this->Ln();
//Restauración de colores y fuentes
$this->SetFillColor(224,235,255);
$this->SetTextColor(0);
$this->SetFont('Arial','B',9);
//Datos
$fill=false;
$this->Cell(40,6,'Giampierre','LR',0,'L',$fill);
$this->Cell(40,6,'Calderon','LR',0,'L',$fill);
$this->Cell(40,6,'931098780','LR',0,'L',$fill);
$this->Cell(75,6,'giam_calderon@hotmail.com','LR',0,'L',$fill);
$this->Ln();
$fill=!$fill;
$this->Cell(40,6,'Carlos','LR',0,'L',$fill);
$this->Cell(40,6,'Paredes','LR',0,'L',$fill);
$this->Cell(40,6,'955738051','LR',0,'L',$fill);
$this->Cell(75,6,'thin85@hotmail.com','LR',0,'L',$fill);
$this->Ln();
$fill=!$fill;
$this->Cell(40,6,'Segundo','LR',0,'L',$fill);
$this->Cell(40,6,'Diaz','LR',0,'L',$fill);
$this->Cell(40,6,'985770982','LR',0,'L',$fill);
$this->Cell(75,6,'vidaldiazc@msn.com','LR',0,'L',$fill);
$this->Ln();
$fill=!$fill;
$this->Cell(40,6,'Jose','LR',0,'L',$fill);
$this->Cell(40,6,'Peche','LR',0,'L',$fill);
$this->Cell(40,6,'987531216','LR',0,'L',$fill);
$this->Cell(75,6,'jopebal@gmail.com','LR',0,'L',$fill);
$this->Ln();
$fill=!$fill;
$this->Cell(40,6,'Jose','LR',0,'L',$fill);
$this->Cell(40,6,'Llontop','LR',0,'L',$fill);
$this->Cell(40,6,'953977249','LR',0,'L',$fill);
$this->Cell(75,6,'crismareniec@gmail.com','LR',0,'L',$fill);
$fill=true;
   $this->Ln();
   $this->Cell(195,0);
}  
}
$pdf=new PDF();
//Títulos de las columnas
$header=array('Nombres','Apellidos','Telefono','Email');
$pdf->AliasNbPages();
//Primera página
$pdf->AddPage();
$pdf->SetY(65);
//$pdf->AddPage();
$pdf->TablaSimple($header);
//Segunda página
$pdf->AddPage();
$pdf->SetY(65);
$pdf->TablaColores($header);
$pdf->Output();
?>