Código PHP:
<?php
define('FPDF_FONTPATH','../font/');
require('../fpdf.php');
include_once("../../include_php/funciones.php");
include_once("../../include_php/conexion.php");
$conn = conexion();
$SELECT_SECTOR="SELECT * FROM sector ORDER BY id_sector";
$RES_SECTOR=pg_query($conn, $SELECT_SECTOR);
class PDF extends FPDF
{
function PDF()
{
$this->FPDF('P','mm','Letter');
}
function Header()
{
$this->Image('../../imagenes/logo1.jpg',15,10,20);
$this->SetFont('Arial','B',16);
$this->Cell(80);
$this->Cell(30,20,'Informe de Sectores',0,0,'C');
$this->Ln(20);
$this->SetFont('Arial','B',10);
$this->SetLineWidth(.4);
$this->Cell(15,5,'Codigo',1,0,'L');
$this->Cell(25,5,'Nombre',1,1,'L');
//$this->Cell(18,5,'Nombre',1,1,'L');
}
function Footer()
{
$this->SetY(-15);
$this->SetFont('Arial','I',8);
$this->Cell(0,0,'Copyright© 2009, r0xdrig0 Corporation. All Rights Reserved'.' - Pagina 0'.$this->PageNo(),0,0,'C');
}
}
$pdf=new PDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetLineWidth(.3);
$pdf->SetFillColor('200',200,0);
$pdf->SetFont('Times','','8');
$pdf->SetLineWidth(.1);
$NUM=pg_num_rows($RES_SECTOR);
$fill=0;
$i=0;
while($i<$NUM)
{
$codigo= pg_fetch_result($RES_SECTOR,$i,0);
$nombre= pg_fetch_result($RES_SECTOR,$i,1);
$pdf->Cell(15,5,$codigo,1,0,'L',$fill);
$pdf->MultiCell(25,5,$nombre,1,1,'C',$fill, 'L', 1);
$fill=!$fill;
$i++;
}
$pdf->Ln(20);
$pdf->SetFont('Arial','B',16);
$pdf->Cell(80);
$pdf->Cell(30,20,'Informe de Prueba',0,0,'C');
$pdf->Ln(20);
$pdf->SetFont('Arial','B',10);
$pdf->SetLineWidth(.4);
$pdf->Output();
?>