Cdigo PHP:
<?php
require_once('class.ezpdf.php');
$pdf =& new Cezpdf('a4');
$pdf->selectFont('../fonts/courier.afm');
$pdf->ezSetCmMargins(1,1,1.5,1.5);
$conexion = mysql_connect("localhost", "root", "root");
mysql_select_db("registros", $conexion);
$queEmp = "SELECT * FROM individual where nivel=1";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
$ixx = 0;
while($datatmp = mysql_fetch_assoc($resEmp)) {
$ixx = $ixx+1;
$data[] = array_merge($datatmp, array('num'=>$ixx));
}
$titles = array(
'codigo'=>'<b>codigo</b>',
'edad'=>'<b>edad</b>',
'ciudad'=>'<b>ciudad</b>',
'ocupacion'=>'<b>ocupacion</b>'
);
$options = array(
'shadeCol'=>array(0.9,0.9,0.9),
'xOrientation'=>'center',
'width'=>500
);
$txttit = "<b>BLOG.UNIJIMPE.NET</b>\n";
$txttit.= "Ejemplo de PDF con PHP y MYSQL \n";
$pdf->ezImage("controldeinvent.jpg", "", "150", "none","left");
$pdf->ezText($txttit, 12);
$pdf->ezTable($data, $titles, '', $options);
$pdf->ezText("\n\n\n", 10);
$pdf->ezText("<b>Registros:</b> ".$num_rows, 10);
$pdf->ezText("<b>Fecha:</b> ".date("d/m/Y"), 10);
$pdf->ezText("<b>Hora:</b> ".date("H:i:s")."\n\n", 10);
$pdf->ezStream();
?>