PHP code example of error-feature / yii2-pdfprint

1. Go to this page and download the library: Download error-feature/yii2-pdfprint library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

error-feature / yii2-pdfprint example snippets


<?= \dixonstarter\pdfprint\Pdfprint::widget([
  'elementClass' => '.btn-pdfprint'
]);


<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            [
              'class' => 'yii\grid\SerialColumn',
              'options'=>['style'=>'width:30px;'],
              'contentOptions'=>['class'=>'text-center']
            ],
            // use in column
            [
              'attribute'=>'value',
              'format'=>'html',
              'value'=>function($model){
                return Html::a('<i class="glyphicon glyphicon-print"></i>',['pdf/url'],['class'=>'btn-pdfprint btn btn-default','data-pjax'=>'0']);
              }
            ],
            // use in ActionColumn
            [
              'class' => 'yii\grid\ActionColumn',
              'header'=>'Actions',
              'options'=>['style'=>'width:150px;'],
              'buttonOptions'=>['class'=>'btn btn-default'],
              'template'=>'<div class="btn-group btn-group-sm text-center" role="group">{print} {view} {update} {delete} </div>',
              'buttons'=>[
                'print'=>function($url,$model){
                  return Html::a('<i class="glyphicon glyphicon-print"></i>',['pdf/url'],['class'=>'btn-pdfprint btn btn-default','data-pjax'=>'0']);
                }
              ]
            ],
        ],
    ]); 

php composer.phar