encontré un código y lo adapte, pero me une los alumnos en la misma pagina.
Código PHP:
<?php
require_once('conexion/conexion.php');
$usuario ='select (matricula.nombre_materia),
(m_a.primern),(m_a.primera),(m_a.nota1),(m_a.n1)
from matricula
inner join m_a on (matricula.codigo_matricula)=(m_a.codigo_matricula) order by (m_a.idalumno)';
$usuarios=$mysqli->query($usuario);
if(isset($_POST['create_pdf'])){
require_once('tcpdf/tcpdf.php');
$pdf = new TCPDF('L', 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('JJC');
$pdf->SetTitle($_POST['reporte_name']);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetMargins(20, 20, 20, false);
$pdf->SetAutoPageBreak(true, 20);
$pdf->SetFont('Helvetica', '', 10);
$pdf->addPage();
$content = '';
$content .= '
<div class="row">
<div class="col-md-12">
<h1 style="text-align:center;">'.$_POST['reporte_name'].'</h1>
<table border="1" cellpadding="5">
<thead>
<tr>
<th>materia</th>
<th>Nombre</th>
<th>apellido</th>
<th>nota1</th>
<th>n1</th>
<th>total</th>
</tr>
</thead>
';
while ($user=$usuarios->fetch_assoc()) {
$content .= '
<tr>
<td>'.$user['nombre_materia'].'</td>
<td>'.$user['primern'].'</td>
<td>'.$user['primera'].'</td>
<td>'.$user['nota1'].'</td>
<td>'.$user['n1'].'</td>
<td>'.$user['n1'].'</td>
</tr>
';
}
$content .= '</table>';
$content .= '
<div class="row padding">
<div class="col-md-12" style="text-align:center;">
</div>
</div>
';
$pdf->writeHTML($content, true, 0, true, 0);
$pdf->lastPage();
$pdf->output('Reporte.pdf', 'I');
}
?>
Código HTML:
<!doctype html> <html lang="es"> <head> <meta charset="utf-8"> <title>Boleta Generada</title> <meta name="keywords" content=""> <meta name="description" content=""> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> </head> <body> <div class="container-fluid"> <div class="row padding"> <div class="col-md-12"> <?php $h1 = "Boleta de Calificaciones"; echo '<h1>'.$h1.'</h1>' ?> </div> </div> <div class="row"> <table class="table table-hover"> <thead> <tr> <th>materia</th> <th>Nombre</th> <th>apellido</th> <th>nota1</th> <th>n1</th> <th>total</th> </tr> </thead> <tbody> <?php while ($user=$usuarios->fetch_assoc()) { ?> <tr> <td><?php echo $user['nombre_materia']; ?></td> <td><?php echo $user['primern']; ?></td> <td><?php echo $user['primera']; ?></td> <td><?php echo $user['nota1']; ?></td> <td><?php echo $user['n1']; ?></td> <td>S/. <?php echo $user['n1']; ?></td> </tr> <?php } ?> </tbody> </table> <div class="col-md-12"> <form method="post"> <input type="hidden" name="reporte_name" value="<?php echo $h1; ?>"> <input type="submit" name="create_pdf" class="btn btn-danger pull-right" value="Generar PDF"> </form> </div> </div> </div> </body> </html>
Cualquier ayuda se agradece