html to pdf converter in yii2 with pagination in table

459 views Asked by At
view:

<p>
        <?= Html::a('Download This page', ['report'], ['class' => 'btn btn-danger']) ?>
</p>

controller:


     public function actionReport()
            {
                // setup kartik\mpdf\Pdf component
                $pdf = new Pdf([
                    'content' => $content,
                    'options' => ['title' => 'Krajee Report Title'],
                    'methods' => [
                        'SetHeader' => ['Krajee Report Header'],
                        'SetFooter' => ['{PAGENO}'],
                    ]
                ]);

                return $pdf->render();
        }

This function works perfectly but my html table has pagination . so i am confused how to deal with table that has pagination.

1

There are 1 answers

0
Mihai P. On

You should disable the pagination. it all depends on how you define your data provider (read more about data providers here http://www.yiiframework.com/doc-2.0/guide-output-data-providers.html). Probably you should do something like this

************* = new ActiveDataProvider([
    'pagination' => false,
..............
]);

I think you can also call it like

$dataProvider->pagination =false; 

Just in case you need to disable it in a specific case.