At the moment of changing the local server, the webapp stopped working correctly with the TCPDF and throws the error mentioned above, the environment is the same, xampp in windows and the chrome browser. I leave the code in case someone can help me, the other answers did not work.
<?php
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', 0);
ini_set('log_errors', 1);
ob_start();
require_once "../../../Controllers/ventas.controlador.php";
require_once "../../../Models/ventas.modelo.php";
require_once "../../../Controllers/clientes.controlador.php";
require_once "../../../Models/clientes.modelo.php";
require_once "../../../Controllers/usuarios.controlador.php";
require_once "../../../Models/usuarios.modelo.php";
require_once "../../../Controllers/productos.controlador.php";
require_once "../../../Models/productos.modelo.php";
class imprimirFactura
{
public $codigo;
public function traerImpresionFactura()
{
//TRAEMOS LA INFORMACIÓN DE LA VENTA
$itemVenta = "id";
$valorVenta = $this->codigo;
$respuestaVenta = ControladorVentas::ctrMostrarVentas($itemVenta, $valorVenta);
$fecha = $respuestaVenta["created_at"];
$productos = json_decode($respuestaVenta["products"], true);
$descuento = $respuestaVenta['discount'];
$neto = number_format($respuestaVenta["value"], 2);
$impuesto = number_format($respuestaVenta["tax"], 2);
$propina = 0;
switch ($respuestaVenta['tip_type']) {
case 'porcentual':
$propina = $respuestaVenta['value'] * $respuestaVenta['tip_value'] / 100;
break;
case 'personalizada':
$propina = $respuestaVenta['tip_value'];
break;
default:
break;
}
$total = $propina + $respuestaVenta['total'];
$total = number_format($total, 2);
$propina = number_format($propina, 2);
//TRAEMOS LA INFORMACIÓN DEL CLIENTE
$itemCliente = "id";
$valorCliente = $respuestaVenta["client_id"];
$respuestaCliente = ControladorClientes::ctrMostrarClientes($itemCliente, $valorCliente);
//TRAEMOS LA INFORMACIÓN DEL VENDEDOR
$itemVendedor = "id";
$valorVendedor = $respuestaVenta["vendor_id"];
$respuestaVendedor = ControladorUsuarios::ctrMostrarUsuarios($itemVendedor, $valorVendedor);
//REQUERIMOS LA CLASE TCPDF
require_once('tcpdf_include.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AddPage('P', 'A7');
//---------------------------------------------------------
$bloque1 = <<<EOF
<table style="font-size:5px; text-align:left">
<tr>
<td style="width:160px;">
Fecha: $fecha
</td>
</tr>
</table>
<table style="font-size:8px; text-align:center">
<tr>
<td style="width:160px;">
<div>
<br>
<br>
<b>BON SANDWICH</b>
<br>
Sucursal: Mercado del Norte
<br>
Dirección: Calle 56 No. 55-96
<br>
Local: 28
</div>
</td>
</tr>
</table>
<table style="font-size:7px; text-align:center">
<tr>
<td style="width:160px;">
<div>
<br>
Ticket de venta N.$respuestaVenta[bill_number]
<br>
Cliente: $respuestaCliente[name]
<br>
Vendedor: $respuestaVendedor[name]
<br>
</div>
</td>
</tr>
</table>
EOF;
$pdf->writeHTML($bloque1, false, false, false, false, '');
// ---------------------------------------------------------
foreach ($productos as $key => $item) {
$valorUnitario = number_format($item["price"], 2);
$precioTotal = number_format($item["total"], 2);
$bloque2 = <<<EOF
<table style="font-size:7px;">
<tr>
<td style="width:160px; text-align:left">
$item[name]
</td>
</tr>
<tr>
<td style="width:160px; text-align:right">
$ $valorUnitario Und * $item[quantity] = $ $precioTotal
<br>
</td>
</tr>
</table>
EOF;
$pdf->writeHTML($bloque2, false, false, false, false, '');
}
// ---------------------------------------------------------
$bloque3 = <<<EOF
<table style="font-size:7px;">
<tr>
<td style="width:160px; text-align:left">
Observaciones:
</td>
</tr>
<tr>
<td style="width:160px; text-align:center">
$respuestaVenta[comments]
<br>
</td>
</tr>
</table>
<table style="font-size:6px; text-align:right">
<tr>
<td style="width:80px;">
DESCUENTO:
</td>
<td style="width:80px;">
$descuento %
</td>
</tr>
<tr>
<td style="width:80px;">
NETO:
</td>
<td style="width:80px;">
$ $neto
</td>
</tr>
<tr>
<td style="width:80px;">
IMPUESTO:
</td>
<td style="width:80px;">
$ $impuesto
</td>
</tr>
<tr>
<td style="width:80px;">
PROPINA:
</td>
<td style="width:80px;">
$ $propina
</td>
</tr>
<tr>
<td style="width:160px;">
--------------------------
</td>
</tr>
<tr>
<td style="width:80px;">
<b>TOTAL:</b>
</td>
<td style="width:80px;">
$ $total
</td>
</tr>
</table>
<table style="font-size:6px; text-align:center">
<tr>
<td style="width:160px;">
<br>
<br>
SOMOS RÉGIMEN SIMPLIFICADO Y NO REQUERIMOS RESOLUCIÓN DE LA DIAN
<br>
<br>
<b>Gracias por su compra, bon appetit.</b>
<br>
<br>
<b>Sistema POS ptlab.co</b>
</td>
</tr>
</table>
EOF;
$pdf->writeHTML($bloque3, false, false, false, false, '');
// ---------------------------------------------------------
//SALIDA DEL ARCHIVO
/* Limpiamos la salida del búfer y lo desactivamos */
//$pdf->Output('factura.pdf', 'D');
ob_end_clean();
$pdf->Output('factura' . $respuestaVenta['bill_number'] . '.pdf');
}
}
$factura = new imprimirFactura();
$factura->codigo = $_GET["idVenta"];
$factura->traerImpresionFactura();
?>