Por si tienen alguna duda, agrego el código, para ver si alguien puede ayudarme. La librería, repito, es la
TCPDF;
set_time_limit(0);
$html2pdfPath = Yii::getPathOfAlias('application.extensions.tcpdf');
require_once($html2pdfPath.'\tcpdf.php');
class MiPdf extends TCPDF
{
public function Header()
{
$image_file = '../break/fotos/conquis.png';
$image_young ='../break/fotos/ja.png';
$this->Image($image_file, 10, 10, 25, '', 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
$this->SetFont('helvetica', 'B', 16);
$this->Cell(0, 0, 'Iglesia Linda Vista Shanka', 0, 1, 'C', 0, '', 1);
$this->Cell(15);
$this->Cell(0, 0, 'Distrito Adonaí', 0, 1, 'C', 0, '', 1);
$this->Cell(15);
$this->Cell(0, 0, 'Club de Conquistadores Zohet', 0, 1, 'C', 0, '', 1);
$this->SetFont('helvetica','',16);
$this->Cell(20);
$this->Cell(0, 0, 'Miembros del Club', 0, 1, 'C', 0, '', 1);
$this->Image($image_young,320,10,25,'','PNG','','T', false, 300,'', false, false,0, false, false, false);
}
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />;
// Page number
$this->Cell(0, 10, 'Pagina '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
//load table data from dataProvider
public function ColoredTable($header,$data){
$this->SetFillColor(255,0,0);
$this->SetTextColor(255);
$this->SetDrawColor(128,0,0);
$this->SetLineWidth(0.3);
$this->SetFont('','B');
$this->AddPage();
$this->Ln(40);
//Header
$width= array(45,35,40,60,19,25,29,29,30);
$num_headers = count($header);
for($i=0;$i<$num_headers;$i++){
$this->Cell($width[$i], 7, $header[$i], 1, 0, 'C', 1);
}
$this->Ln();
$this->SetFillColor(224,235,255);
$this->SetTextColor(0);
$this->SetFont('');
//data
$fill=0;
$meses= array("Cero","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
$fechaNacimiento="";
$estatus_bautizado="";
$fecha="";
$i=0;
$val=count($data);
while($i<$val)
{
$fecha=$data[$i]["fechaNacimiento"];
if($fecha!='0000-00-00')
{
$edad = miembros::model()->calcularEdad($fecha);
$fecha_det= explode("-", $fecha);
$dia=$fecha_det[2];
$mes=date("n",strtotime($fecha));
$año=$fecha_det[0];
$fechaNacimiento="{$dia} de {$meses[$mes]} de {$año}";
}
else { $fechaNacimiento=""; $edad=""; }
if($data[$i]["bautizado"]==1){
$estatus_bautizado='Si';
}
else{
$estatus_bautizado='No';}
$this->Cell($width[0], 6, $data[$i]["nombres"], 'LR', 0, 'L', $fill);
$this->Cell($width[1], 6, $data[$i]["apPaterno"], 'LR', 0, 'L', $fill);
$this->Cell($width[2], 6, $data[$i]["apMaterno"], 'LR', 0, 'L', $fill);
$this->Cell($width[3], 6, $fechaNacimiento, 'LR', 0, 'L', $fill);
$this->Cell($width[4], 6, $edad, 'LR', 0, 'C', $fill);
$this->Cell($width[5], 6, $estatus_bautizado, 'LR', 0, 'C', $fill);
$this->Cell($width[6], 6, $data[$i]["numCelular"], 'LR', 0, 'C', $fill);
$this->Cell($width[6], 6, $data[$i]["numTelefono"], 'LR', 0, 'C', $fill);
$this->Cell($width[7], 6, $data[$i]["Clase"]["nombre"], 'LR', 0, 'C', $fill);
$this->Ln();
$fill=!$fill;
$i++;
}
$this->Cell(array_sum($width), 0, '', 'T');
}
}
$pdf = new MiPdf('L', PDF_UNIT, 'Legal', true, 'UTF-8', false);
$pdf->SetAutoPageBreak(TRUE, 0);
$dataProvider = $_SESSION['datos_filtrados']->getData();
$contador=count($dataProvider);
$pdf->SetFont('helvetica','',12);
$header = array('Nombres','Apellido paterno', 'Apellido materno', 'Fecha Nacimiento','Edad','Bautizado','Celular','Teléfono','Clase');
$pdf->ColoredTable($header, $dataProvider);
$pdf->Ln(40);
$pdf->Output('ListaMiembros.pdf','D');
exit;
?>