yii2 mpdf

安装

php composer.phar require kartik-v/yii2-mpdf "*"

或者把 "kartik-v/yii2-mpdf": "*"  加到composer.json文件的require段 执行 composer update

$pdf = new Pdf([
    'mode' => Pdf::MODE_UTF8,
    'format' => Pdf::FORMAT_A4,
    'orientation' => Pdf::ORIENT_LANDSCAPE,
    'destination' => Pdf::DEST_BROWSER,    //值为Pdf::DEST_FILE时生成文件
    'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
  //设置中文 'options' => [ 'title' => '中文', 'autoLangToFont' => true, 'autoScriptToLang' => true, 'autoVietnamese' => true, 'autoArabic' => true, ], ]); $pdf->content=$contents; $pdf->render();

 

posted @ 2016-11-28 21:36  caroline2016  阅读(255)  评论(0编辑  收藏  举报