susilolab/yii2-printthis

Print html by selector for Yii Framework 2.0

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 7

Type:yii2-extension

v1.0.4 2018-11-15 09:25 UTC

This package is not auto-updated.

Last update: 2024-11-10 06:33:33 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: "";    
    }
}