yii2assets / yii2-printthis
为 Yii Framework 2.0 通过选择器打印 HTML
v1.0.2
2018-03-28 14:22 UTC
Requires
- bower-asset/printthis: *
- yiisoft/yii2: *
README
安装
使用 composer require yii2assets/yii2-printthis "^1.0" 或者在 composer.json 中添加此行 "yii2assets/yii2-printthis": "^1.0"
用法
要使用此小部件,将以下代码插入视图文件
<?php echo PrintThis::widget([ 'htmlOptions' => [ 'id' => 'PrintThis', 'btnClass' => 'btn btn-info', 'btnId' => 'btnPrintThis', 'btnText' => 'พิมพ์หน้านี้', 'btnIcon' => 'fa fa-print' ], 'options' => [ 'debug' => false, 'importCSS' => true, 'importStyle' => false, 'loadCSS' => "path/to/my.css", 'pageTitle' => "", 'removeInline' => false, 'printDelay' => 333, 'header' => null, 'formValues' => true, ] ]); ?>
打印区域视图文件
<div id="PrintThis"> Your Html code here </div>
你可以添加 CSS 来禁用链接显示
@media print { .noprint {display:none !important;} a:link:after, a:visited:after { display: none; content: ""; } }