yii2 advanced generate mpdf/pdf

Hi community,

Newbie here and trying to generate pdf in advanced.

Help me to generate tables generated by CRUD into pdf file.


<?= GridView::widget([

    'dataProvider' =&gt; &#036;dataProvider,

   // 'filterModel' =&gt; &#036;searchModel,

    'columns' =&gt; [

      //  ['class' =&gt; 'yii&#092;grid&#092;SerialColumn'],









        //['class' =&gt; 'yii&#092;grid&#092;ActionColumn'],


]); ?&gt;

Searching a lot of extension and tutorial<br />

and saw this extension kartik-v/yii2-mpdf (demos.krajee.com/mpdf)

trying to work on it but still no luck …

Thanks yii.

In your action index :

public function actionIndex()



  $pdf = Yii::$app->pdf;//or $pdf = new Pdf...

  $pdf->content = $this->render('index', ['searchModel'=>searchModel, 'dataProvider'=>$dataProvider]);

  return $pdf->render();


Hi thanks a lot but got this error after wards


Maximum function nesting level of ‘100’ reached, aborting!

hello friends,

i am using mpdf in yii2.

i had setted all the parameters in autoload_namespaces.php.

i used it also in controller. In controller also found that class and showing method list also

but while in browser showing error

exception ‘yii\base\ErrorException’ with message ‘Class ‘mPDF’ not found’ in /var/www/mysite.in/demo/controllers/StudController.php:198

Stack trace:

#0 [internal function]: yii\base\Application->handleFatalError()

#1 {main}

in line

$mpdf = new mPDF();

how to short out it ?

Check the namespace of mpdf has included in your controller.