Código PHP:
$numero_alumno="";
$firmante=$responsable;
$titulo=$puesto;
$data="";
$numero_alumno=$numero_alumno.numero;
//$firmante=$firmante.$responsable;
//$titulo=$titulo.$puesto;
$data=$data.$fecha;
define('FPDF_FONTPATH','font/');
require('fpdf.php');
class PDF extends FPDF
{
//Cabecera de página
function Header()
{
$this->Image('seminario.jpg',10,8,33);
$this->setfont('arial','b',15);
$this->cell(0,10,'SEMINARIO PONTIFICIO DE SANTIAGO',0,0,'C');
$this->ln(5);
$this->cell(0,10,'SECRETARIA DE ESTUDIOS',0,0,'C');
$this->ln(20);
$this->setfont('arial','b',18);
$this->cell(0,10,'CERTIFICADO DE ESTUDIOS',0,0,'C');
$this->ln(5);
$this->setfont('arial','b',15);
$this->cell(0,10,'(CURRICULUM 1988)',0,0,'C');
$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,'Seminario Pontificio Mayor de Santiago - Secretaría de Estudios.',0,0,'C');
$this->ln(4);
$this->Cell(0,10,'Av. Walker Martínez 2020, La Florida, Santiago - Casilla 3-D - Teléfono: 4883800 - Fax: 4883811 - Email:[email protected]',0,0,'C');
}
}
//Creación del objeto de la clase heredada
$pdf=new PDF();
$pdf->Open();
$pdf->SetAutoPageBreak(false);
$pdf->AliasNbPages();
$pdf->AddPage();
$link=mysql_connect("127.0.0.1","rogel","iara");
mysql_select_db("estudios");
$con_alu="select a_nombre,cedula,fecha_ing,curri,diosesis from alumnos where numero='$numero'";
$resp_alu=mysql_query($con_alu,$link);
$alumno=mysql_fetch_array($resp_alu);
$nombre=$alumno["a_nombre"];
$rut=$alumno["cedula"];
$ingreso=$alumno["fecha_ing"];
$curriculum=$alumno["curri"];
$diocesis=$alumno["diosesis"];
$pdf->setfillcolor(255,255,255);
$pdf->setx(25);
$pdf->setfont('arial','',10);
$pdf->cell(30,4,'Nombre',0,0,'L',1);
$pdf->cell(53,4,''.$nombre.'',0,0,'L',1);
$pdf->ln(4);
$pdf->setx(25);
$pdf->cell(30,4,'R.U.T.',0,0,'L',1);
$pdf->cell(53,4,''.$rut.'',0,0,'L',1);
$pdf->ln(4);
$pdf->setx(25);
$pdf->cell(30,4,'Ingreso',0,0,'L',1);
$pdf->cell(53,4,''.$ingreso.'',0,0,'L',1);
$pdf->ln(4);
$pdf->setx(25);
$pdf->cell(30,4,'Curriculum',0,0,'L',1);
$pdf->cell(53,4,''.$curriculum.'',0,0,'L',1);
$pdf->ln(4);
$pdf->setx(25);
$pdf->cell(30,4,'Diocesis',0,0,'L',1);
$pdf->cell(53,4,''.$diocesis.'',0,0,'L',1);
$string="Select notas.cod, cursos.c_nombre, cursos.profesor, cursos.creditos, notas.sem_ano, notas.n_alumno, notas.nota from notas, cursos
where (notas.cod=cursos.sigla) and notas.n_alumno='$numero' order by cursos.c_nombre";
$resp=mysql_query($string,$link);
//inicio de posición por pagina
$y_axis_initial=90;
//titulos actuales por pagina
$pdf->setfillcolor(232,232,232);
$pdf->setfont('arial','',10);
$pdf->sety($y_axis_initial);
$pdf->setx(25);
$pdf->cell(13,4,'Sigla',1,0,'C',1);
$pdf->cell(70,4,'Asignatura',1,0,'L',1);
$pdf->cell(45,4,'Profesor',1,0,'L',1);
$pdf->cell(10,4,'CR',1,0,'C',1);
$pdf->cell(10,4,'S/A',1,0,'C',1);
$pdf->cell(10,4,'Nota',1,0,'C',1);
$y_axis=96;//aqui empiezo a dar valor a $y_axis
$i=0;
$max=25;
$row_height=6;
while($row=mysql_fetch_array($resp))
{
if($i==$max)
{
$pdf->AddPage();
$pdf->setfillcolor(255,255,255);
$pdf->setx(25);
$pdf->setfont('arial','',10);
$pdf->cell(30,4,'Nombre',0,0,'L',1);
$pdf->cell(53,4,''.$nombre.'',0,0,'L',1);
$pdf->ln(4);
$pdf->setx(25);
$pdf->cell(30,4,'R.U.T.',0,0,'L',1);
$pdf->cell(53,4,''.$rut.'',0,0,'L',1);
$pdf->ln(4);
$pdf->setx(25);
$pdf->cell(30,4,'Ingreso',0,0,'L',1);
$pdf->cell(53,4,''.$ingreso.'',0,0,'L',1);
$pdf->ln(4);
$pdf->setx(25);
$pdf->cell(30,4,'Curriculum',0,0,'L',1);
$pdf->cell(53,4,''.$curriculum.'',0,0,'L',1);
$pdf->ln(4);
$pdf->setx(25);
$pdf->cell(30,4,'Diocesis',0,0,'L',1);
$pdf->cell(53,4,''.$diocesis.'',0,0,'L',1);
$pdf->setfillcolor(232,232,232);
$pdf->sety($y_axis_initial);
$pdf->setx(25);
$pdf->cell(13,4,'Sigla',1,0,'C',1);
$pdf->cell(70,4,'Asignatura',1,0,'L',1);
$pdf->cell(45,4,'Profesor',1,0,'L',1);
$pdf->cell(10,4,'CR',1,0,'C',1);
$pdf->cell(10,4,'S/A',1,0,'C',1);
$pdf->cell(10,4,'Nota',1,0,'C',1);
$y_axis=$row_height;/*aqui $y_axis toma el valor de seis, esto ocurre solo cuando sobrepasa el limite de 25 registros por pagina*/
$i=0;
}
$sigla=$row[0];
$ramo=$row[1];
$profesor=$row[2];
$credito=$row[3];
$semestre=$row[4];
$nota=$row[6];
$pdf->sety($y_axis);/*aqui su valor es de 96 y anda bien para la primera pagina porque pone los registros justo debajo de los titulo*/
$pdf->setx(25);
$pdf->SetFont('Arial','I',8);
$pdf->cell(13,4,''.$sigla.'',1,0,'C',1);
$pdf->cell(70,4,''.$ramo.'',1,0,'L',1);
$pdf->cell(45,4,''.$profesor.'',1,0,'L',1);
$pdf->cell(10,4,''.$credito.'',1,0,'C',1);
$pdf->cell(10,4,''.$semestre.'',1,0,'C',1);
$pdf->cell(10,4,''.$nota.'',1,0,'C',1);
$y_axis=$y_axis + $row_height;
$i=$i + 1;
}
mysql_close($link);
$pdf->sety(270);
$pdf->SetFont('Arial','I',8);
$pdf->Cell(100);
$pdf->Cell(75,4,''.$firmante.'',0,'','C');
$pdf->ln(6);
$pdf->SetFont('Times','',14);
$pdf->Cell(100);
$pdf->Cell(75,4,''.$titulo.'',0,'','C');
$pdf->Output();
les agradezco su ayuda
![Adios](http://static.forosdelweb.com/fdwtheme/images/smilies/adios.gif)