html2pdf icon indicating copy to clipboard operation
html2pdf copied to clipboard

PHP Fatal error: Uncaught Error: Class 'Spipu\\Html2Pdf\\Html2Pdf' not found

Open mvrand opened this issue 3 years ago • 1 comments

Good evening, I read a lot on google and tried the suggestions but could not find the right solution. Do you have an idea for me Thank you

script require DIR . '/vendor/autoload.php'; use Spipu\Html2Pdf\Html2Pdf; ... $facture = new \Spipu\Html2Pdf\Html2Pdf('P', 'A4', 'fr'); $facture->writeHTML($html); $facture->output();

result PHP Fatal error: Uncaught Error: Class 'Spipu\Html2Pdf\Html2Pdf' not found in /var/www/mrm/htdocs/facture_mrm.php:148

intall ok php composer.phar require spipu/html2pdf Using version ^4.6 for spipu/html2pdf ./composer.json has been updated Running composer update spipu/html2pdf Loading composer repositories with package information Updating dependencies Nothing to modify in lock file Installing dependencies from lock file (including require-dev) Nothing to install, update or remove Generating autoload files

I did : uninstall complete composer + html2pdf then reinstall

mvrand avatar Feb 22 '21 15:02 mvrand

Hello,

You could try this :

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

$facture = new Html2Pdf('P', 'A4', 'fr');
$facture->writeHTML('<h1>Vive la France</h1>');
$facture->output();

pgrimaud avatar Feb 26 '21 18:02 pgrimaud