ovidiupop/yii2-printthis

Print html by selector for Yii Framework 2.0

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-main 2024-01-15 16:37 UTC

This package is auto-updated.

Last update: 2024-05-15 17:16:44 UTC


README

Install

composer require ovidiupop/yii2-printthis "@dev"

or add this line to composer.json

"ovidiupop/yii2-printthis": "@dev"

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' => '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

<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: "";    
    }
}