Home > front end >  Undefined type 'Mpdf\Mpdf' in Laravel 7.2.5
Undefined type 'Mpdf\Mpdf' in Laravel 7.2.5

Time:08-17

Please help me because I'm not able to create a PDF in Laravel 7.2.5 . My mPDF version ^6.1 . When i'm writing $mpdf= new \Mpdf\Mpdf(); , throws an error as image below :

error message

Error in localhost :

error localhost

CodePudding user response:

Try to update mpdf to version 7.1.7 (at least). mpdf 7.0 doesn't work with php 7.3.

PHP ≥ 5.6.0 and < 7.3.0.
PHP 7.3 is supported since mPDF v7.1.7
PHP mbstring (including mbregex, which needs to be explicitly enabled in some environments)

CodePudding user response:

See the note on the documentation page.

Note: For mPDF < 7.0 use

<?php

$mpdf = new \mPDF();

Dokumentation: https://mpdf.github.io/getting-started/creating-your-first-file.html

  • Related