Class 'Spipu Html2pdf Html2pdf' not found

Asked

Viewed 105 times

-1

I’m a beginner in Laravel. I got a legacy system with the following settings: Laravel 3.2.12 and PHP 5.6. This system uses DOMPDF. However, it cannot generate one of the html files due to the size. Because of this, I did the installation via Html2pdf. But it always shows the error Class 'Spipu Html2pdf Html2pdf' not found. What am I doing wrong?

use Spipu\Html2Pdf\Html2Pdf;

$html = View::make('template.pdf.relatorio-consolidado-pc', compact(
        'formato',
            'projeto',
            'pc');
$html2pdf = new Html2Pdf('P','A4','pt');
            $html2pdf->writeHTML($html);
            $pdf = $html2pdf->Output('relatorio-projeto-esportivo');

 return response ($pdf);
``````````````````````````````````````````

1 answer

0

Try following this template, add autoload require to your code.

require __DIR__.'/vendor/autoload.php';

use Spipu\Html2Pdf\Html2Pdf;

$html2pdf = new Html2Pdf();
$html2pdf->writeHTML('Olá, isso é um teste!');
$html2pdf->output();
  • It didn’t work out. The following error appears: require(C: xampp htdocs incentivo-php application controllers prestacantas/vendor/autoload.php): failed to open stream: No such file or directory

  • This message says that the file or directory does not exist, it may be that C: xampp htdocs incentive-php application controllers prestacaocontas/vendor/autoload.php is not the correct path.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.