yii2assets/yii2-printthis

Print html by selector for Yii Framework 2.0

Installs: 119 477

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 7

Open Issues: 5

Type:yii2-extension

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

This package is not auto-updated.

Last update: 2024-04-13 17:51:53 UTC


README

Install

composer require yii2assets/yii2-printthis "^1.0" or add this line to composer.json "yii2assets/yii2-printthis": "^1.0"

Usage

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

<?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,
	]
]);
?>

in view file for print area

<div id="PrintThis">
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: "";    
    }
}