Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to undefined function Mpdf\mb_regex_encoding()

i want to make some reports with yii2 Mpdf but when i running the program i got an error like Call to undefined function Mpdf\mb_regex_encoding() please tell me how to solved this program

this is my controller

public function actionRpt($id)
{   
    $content = $this->renderPartial('rpt', [
            'model' => $this->findModel($id),
        ]);

    // setup kartik\mpdf\Pdf component
    $pdf = new Pdf([
        // set to use core fonts only
        'mode' => Pdf::MODE_UTF8, 
        // A4 paper format
        'format' => Pdf::FORMAT_A4, 
        // portrait orientation
        'orientation' => Pdf::ORIENT_PORTRAIT, 
        // stream to browser inline
        'destination' => Pdf::DEST_BROWSER, 
        // your html content input
        'content' => $content,  
        // format content from your own css file if needed or use the
        // enhanced bootstrap css built by Krajee for mPDF formatting 
        'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
        // any css to be embedded if required
        'cssInline' => '.kv-heading-1{font-size:18px}', 
         // set mPDF properties on the fly
        'options' => ['title' => 'RPT NCR'],
         // call mPDF methods on the fly
        'methods' => [ 
            'SetHeader'=>['NCR'], 
            'SetFooter'=>['{PAGENO}'],
        ]
    ]);
}
like image 818
Owl Avatar asked Oct 26 '17 10:10

Owl


1 Answers

You have to have mbstring PHP extension enabled, including the mbregex option, which needs to be explicitly enabled in some environments.

https://mpdf.github.io/about-mpdf/requirements-v7.html

like image 128
Finwe Avatar answered Sep 30 '22 03:09

Finwe