Yii 2.0 use mPDF generate Chinese PDF file

{ update config }

//open /mPDF/config.php
$this->autoLangToFont = true; // mPDF 6.0 (similar to old useLang)

 

{ Demo Code }

require dirname ( dirname ( __DIR__ ) ).'/vendor/mpdf/vendor/autoload.php';

$mpdf = new \mPDF(
        'utf-8',    // mode - default ''
        'A4-L',  // format - A4, for example, default ''
         0,     // font size - default 0
         '',    // default font family
         10,    // margin_left
         10,    // margin right
         10,     // margin top
         0,    // margin bottom
         9,     // margin header
         9     // margin footer
        );
$mpdf->autoScriptToLang = true;

// add html to pdf
$mpdf->WriteHTML("Hi everyone, this msg come from YiiLib.com");

// Output the generated PDF to Browser
$mpdf->Output();

//save pdf as yiilib.pdf
$mpdf->Output('/var/tmp/yiilib.pdf');