如果你使用 https://github.com/kartik-v/yii2-mpdf
那么1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30$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_LANDSCAPE,
// stream to browser inline
'destination' => Pdf::DEST_BROWSER,
// your html content input
'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:24px}',
// set mPDF properties on the fly
'options' => [
'title' => '中文',
'autoLangToFont' => true, //这几个配置加上可以显示中文
'autoScriptToLang' => true, //这几个配置加上可以显示中文
'autoVietnamese' => true, //这几个配置加上可以显示中文
'autoArabic' => true, //这几个配置加上可以显示中文
],
// call mPDF methods on the fly
'methods' => [
'SetHeader' => ['中文'],
'SetFooter' => ['{PAGENO}'],
]
]);
解决https://github.com/kartik-v/yii2-mpdf的中文乱码
- 本文链接: https://kernight.github.io/2017/05/12/解决https-github-com-kartik-v-yii2-mpdf的中文乱码.html
- 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!