artsoft/yii2-print-this

Print html by selector for Yii Framework 2.0

Installs: 15

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 7

Type:yii2-extension

v1.0.2 2018-03-28 14:22 UTC

This package is auto-updated.

Last update: 2024-04-12 01:42:52 UTC


README

forked from Yii2Assets/yii2-print-this

Install

composer require artsoft/yii2-print-this "dev-master"

or add this line to composer.json

"artsoft/yii2-print-this": "dev-master"

Usage

To use this widget, insert the following code into a view file:

<?php
echo PrintThis::widget([
	'htmlOptions' => [
            'id' => ['print_info', 'print_body'],
            'btnOptions' => [
                'id' => 'btnId',
                'class' => 'btn btn-default btn-sm',
                'data-toggle' => 'tooltip',
                'data-container' => 'body',
                'data-placement' => 'top',
                'data-original-title' => 'Print',
            ]
            'btnText' => 'Print',
            '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,
	]
]);
?>

in view file for print area
```html
<div id="print_info">
Your Html code here
</div>
...
<div id="print_body">
Your Html code here
</div>

you can add css for disable link display

@media print {
    .noprint {display:none !important;}
    a:link:after, a:visited:after {  
      display: none;
      content: "";    
    }
}

More option

https://github.com/jasonday/printThis