Amigos necesito su ayuda para ponerle la numeración de página a un reporte que está hecho en tcpdf
Este es el código:
<?php
include("conexion.php");}
if(isset($_POST['crear'])){
include("funciones.php");
include('../tcpdf/tcpdf.php');
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('autor');
$pdf->SetTitle($_POST['reportes']);
$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="container">
<div class="row">
<div class="col-lg-12">
<table class="table " border="1" cellpadding="5">
<thead>
<tr>
<th colspan="4">
<h3 class="text-center" align="center">reporte</h3>
<p align="center">';
$fecha_ac = actual_date();
$content .= '
'.$fecha_ac.'
</p>
</th>
</tr>
</thead>
<tbody>
';
$sql = "SELECT * FROM registros WHERE codigo_registro LIKE '2%' ";
$ejecutar = $conexion->query($sql);
while($acts = $ejecutar->fetch_assoc()){
$content .= '
<tr>
<td colspan="3" >'.$acts['codigo_registro'].'.'.utf8_encode($acts['nombre_registro']).'</td>
<td align="center">$ '.number_format($acts['cantidad1']-$acts['cantidad2'],2).'</td>
</tr> ';
}
$consulta = "SELECT SUM((cantidad1-cantidad2)) cantidadtotal FROM registros WHERE codigo_registro LIKE '2%' ";
$ejecutar_consulta = $conexion->query($consulta);
if($ejecutar_consulta->num_rows > 0){
while ($regs = $ejecutar_consulta->fetch_assoc()) {
$content .= '
<tr>
<td class="text-left" colspan="3" ><strong>Total</strong></td>
<td align="center">$ '.number_format($regs['cantidadtotal'],2).'</td>
</tr>';
}
}
$content .= '
</tbody>
</table>
</div>
</div>
</div>
';
$pdf->writeHTMLCell(0, 0, '', '', $content, 0, 1, 0, true, '', true);
ob_end_clean();
$pdf->output('Reporte.pdf', 'I');
}
?>