As my question says, I use the tcpdf library and here I leave the code:
<?php
require_once('tcpdf/config/lang/eng.php');
require_once('tcpdf/tcpdf.php');
require_once('../config.php');
$pdf = new TCPDF('P', 'mm', 'legal', true, 'UTF-8', false);
$pdf->SetTitle('PDF Autogenerado en PHP'); //Titlo del pdf
$pdf->setPrintHeader(false); //No se imprime cabecera
$pdf->setPrintFooter(false); //No se imprime pie de pagina
$pdf->SetMargins(10, 20, 10, false); //Se define margenes izquierdo, alto, derecho
$pdf->SetAutoPageBreak(true, 5); //Se define un salto de pagina con un limite de pie de pagina
$pdf->addPage();
if(isset($_GET['id']))
{
$id=$_GET['id'];
}
$sql = "SELECT * FROM acarga WHERE bl3 = '$id' ORDER by cod_it ";
$cosas = $connex->query($sql);
$html = '';
$item = 1;
foreach($cosas as $row){
$bl = $row['bl3'];
$item = $row['cod_it'];
$conductor = $row['noap'];
$unidad = $row['uni_ca'];
$placa = $row['pla_ca'];
$tipopa = $row['tipo_pa'];
$registro = date('d/m/Y', strtotime($row['fecha']));
$estado = $row['estado'];
$hora = date('h:i A', strtotime($row['hora']));
$imagen = $row['ruta_imagen'];
$destino = $row['dest'];
$coment = $row['comenta'];
//$barcode = $row['cosa_codigo_barra'];
//$barcode = $pdf->serializeTCPDFtagParameters(array($barcode, 'C128', '', '', 72, 25, 0.5, array('position'=>'S', 'border'=>false, 'padding'=>2, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>7, 'stretchtext'=>6), 'N'));
$html .= '
<table border="1" cellpadding="5">
<tr>
<td bgcolor="#E6E6E6"><b>Caso: </b></td>
<td>'.$bl.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Item: </b></td>
<td>'.$item.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Unidad/Camion: </b></td>
<td>'.$unidad.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Placa del camión: </b></td>
<td>'.$placa.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Tipo de Mesa/chasis: </b></td>
<td>'.$tipopa.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Conductor: </b></td>
<td>'.$conductor.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Fecha: </b></td>
<td>'.$registro.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Hora: </b></td>
<td>'.$hora.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Estado: </b></td>
<td>'.$estado.'<font color="red">*</font> </td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Destino: </b></td>
<td>'.$destino.'</td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Foto: </b></td>
<td><img src="../img/'.$imagen.'"width="250px" height="180px"></td>
</tr>
<tr>
<td bgcolor="#E6E6E6"><b>Comentario: </b></td>
<td>'.$coment.'</td>
</tr>
</table><br><br>
';
$item = $item+1;
}
$pdf->SetFont('Helvetica', '', 10);
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->lastPage();
$pdf->output('Reporte.pdf', 'I');
?>