Welcome Guest, Not a member yet? Register   Sign In
mpdf class not fount error CI 4.1.5
#1
Shocked 

I am using CI 4.1.5, installed from composer. On fedora 35 x86_54.

Code:
$ composer create-project codeigniter4/appstarter ci4-mpdf


I installed mpdf from composer as well, the code I use in the invocation is:

Code:
$ composer require mpdf/mpdf


PHP Code:
<?php
namespace App\Controllers;

class 
Home extends BaseController{
     public function index(){
         $mpdf = new \Mpdf\Mpdf();
         $html view('html_to_pdf',[]);
         $mpdf->WriteHTML($html);
         $this->response->setHeader('Content-Type''application/pdf');
         $mpdf->Output('arjun.pdf','I');
     }



And I also modified it as follows:

PHP Code:
<?php
namespace App\Controllers;
use 
Mpdf\Mpdf;

class 
Home extends BaseController{
     public function index(){
         $mpdf = new Mpdf();
         $html view('html_to_pdf',[]);
         $mpdf->WriteHTML($html);
         $this->response->setHeader('Content-Type''application/pdf');
         $mpdf->Output('arjun.pdf','I');
     }


and the error show this:

Code:
Error
Class "Mpdf\Mpdf" not found
APPPATH/Controllers/Home.php at line 43

38    {
39        return view('welcome_message');
40    }
41
42    public function pdf(){
43        $mpdf = new Mpdf();



Checking the composer autoload file, I found that it does not include the mpdf installation path, I tried to regenerate it with composer dump-autoload and it still does not work.

I tried to add it manually, and it doesn't work either. Is it necessary to modify some other composer path or add the mpdf installation manually?

Thanks!
Reply


Messages In This Thread
mpdf class not fount error CI 4.1.5 - by ferb - 11-18-2021, 11:07 AM
RE: mpdf class not fount error CI 4.1.5 - by ferb - 11-18-2021, 02:22 PM
RE: mpdf class not fount error CI 4.1.5 - by ferb - 11-19-2021, 01:00 PM
RE: mpdf class not fount error CI 4.1.5 - by ferb - 11-21-2021, 05:13 PM
RE: mpdf class not fount error CI 4.1.5 - by ferb - 11-22-2021, 11:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB