I'm getting the following error:
Fatal error: Class 'wkhtmltopdf \ Pdf' not found in /Applications/XAMPP/xamppfiles/htdocs/common/class/PrePagoConsulta.php online 480
Code snippet:
use wkhtmltopdf\Pdf;
class PrePagoConsulta extends Query
{
public function gerarPDF($html, $nomeArquivo){
$pdf = new Pdf($html); // * Linha 480
if (!$pdf->saveAs($_SERVER['DOCUMENT_ROOT'].'/upload/consultas-pre/'.$nomeArquivo.'.pdf')) {
echo $pdf->getError();
}
}
}
And the folder structure looks like this:
In autoload_psr4.php , I'm setting as follows:
return array(
'wkhtmltopdf\' => array($vendorDir.'/wkhtmltopdf/src')
);
How can I fix the error? Where am I going wrong? hehe