/**
  *
  * for export pdf at actionView
  *
  * @param type $id
  * @return type
  */
 public function actionPdf($id)
 {
     $model = $this->findModel($id);
     $providerReportTest = new \yii\data\ArrayDataProvider(['allModels' => $model->reportTests]);
     $content = $this->renderAjax('_pdf', ['model' => $model, 'providerReportTest' => $providerReportTest]);
     $pdf = new \kartik\mpdf\Pdf(['mode' => \kartik\mpdf\Pdf::MODE_CORE, 'format' => \kartik\mpdf\Pdf::FORMAT_A4, 'orientation' => \kartik\mpdf\Pdf::ORIENT_PORTRAIT, 'destination' => \kartik\mpdf\Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => \Yii::$app->name], 'methods' => ['SetHeader' => [\Yii::$app->name], 'SetFooter' => ['{PAGENO}']]]);
     return $pdf->render();
 }
<?php

return ['language' => 'zh-CN', 'sourceLanguage' => 'zh-CN', 'timeZone' => 'Asia/Shanghai', 'components' => ['request' => array('enableCsrfValidation' => false), 'db' => ['class' => 'yii\\db\\Connection', 'dsn' => 'mysql:host=192.168.10.109;dbname=yii2advanced', 'username' => 'root', 'password' => '123456', 'charset' => 'utf8'], 'mailer' => ['class' => 'yii\\swiftmailer\\Mailer', 'viewPath' => '@common/mail', 'useFileTransport' => true], 'urlManager' => ['enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => ['<controller:\\w+>/<id:\\d+>' => '<controller>/view', '<controller:\\w+>/<action:\\w+>/<id:\\d+>' => '<controller>/<action>', '<controller:\\w+>/<action:\\w+>' => '<controller>/<action>', ['class' => 'yii\\rest\\UrlRule', 'controller' => ['user', 'news', 'country']]]], 'view' => ['class' => 'yii\\web\\View', 'renderers' => ['tpl' => ['class' => 'yii\\smarty\\ViewRenderer', 'cachePath' => '@runtime/Smarty/cache', 'compilePath' => '@runtime/Smarty/compile', 'options' => [], 'pluginDirs' => ['@app/../common/plugins', '@app/../vendor/smarty/smarty/libs/plugins']], 'twig' => ['class' => 'yii\\twig\\ViewRenderer', 'cachePath' => '@runtime/Twig/cache', 'options' => ['auto_reload' => true], 'globals' => ['html' => '\\yii\\helpers\\Html'], 'uses' => ['yii\\bootstrap']]]], 'pdf' => ['class' => kartik\mpdf\Pdf::classname(), 'mode' => kartik\mpdf\Pdf::MODE_UTF8, 'format' => kartik\mpdf\Pdf::FORMAT_A4, 'orientation' => kartik\mpdf\Pdf::ORIENT_PORTRAIT, 'destination' => kartik\mpdf\Pdf::DEST_BROWSER, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.css', 'cssInline' => '.kv-heading-1{font-size:24px}', 'options' => ['title' => '中文', 'autoLangToFont' => true, 'autoScriptToLang' => true, 'autoVietnamese' => true, 'autoArabic' => true], 'methods' => ['SetHeader' => ['中文'], 'SetFooter' => ['{PAGENO}']]]]];