user5549553
user5549553

Reputation:

Using mpdf library in codeigniter return error

Error

A PHP Error was encountered

Severity: Warning

Message: preg_match() expects parameter 2 to be string, object given

Filename: libraries/mpdf.php

Line Number: 22307

Backtrace:

File: D:\xamp\htdocs\ci_test\application\libraries\mpdf.php Line: 22307 Function: preg_match

File: D:\xamp\htdocs\ci_test\application\libraries\mpdf.php Line: 13118 Function: ReadCharset

File: D:\xamp\htdocs\ci_test\application\controllers\Welcome.php Line: 28 Function: WriteHTML

File: D:\xamp\htdocs\ci_test\index.php Line: 292 Function: require_once

this is my controller

    $this->load->library('mpdf');

    $html = $this->load->view('welcome_message');

    $this->mpdf->WriteHTML($html);
    $this->mpdf->Output();

Upvotes: 1

Views: 1746

Answers (1)

Niranjan N Raju
Niranjan N Raju

Reputation: 11987

Try loading view likr this,

$html = $this->load->view('welcome_message','',TRUE);
                                               ^ will get the value to variable.

Upvotes: 3

Related Questions