I have a view in which there are some records in it. I want to download them in a `PDF`. But while clicking on the button I am unable to see the downloaded `pdf`.

**My action controller**

```
public function actionViewpdf()
{

    $searchModel = new IssueMeters();
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

    if(isset($_POST['issue_pdf']))
    {
        $content = $this->render('viewpdf', [
            'dataProvider' => $dataProvider,
            'searchModel' => $searchModel
        ]);
        $pdf = new Pdf([
            // set to use core fonts only
            'mode' => Pdf::MODE_UTF8,
            // A4 papr format
            'format' => Pdf::FORMAT_A3,
            // portrait orientation
            'orientation' => Pdf::ORIENT_LANDSCAPE,
            // stream to browser inline
            'destination' => Pdf::DEST_BROWSER,
            // your html content input
            'content' => $content,
            // format content from your own css file if needed or use the
            // enhanced bootstrap css built by Krajee for mPDF formatting
            'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
            // any css to be embedded if required
            'cssInline' => '.kv-heading-1{font-size:18px}',
            // set mPDF properties on the fly
            'options' => ['title' => 'Accurate Survey'],
            // call mPDF methods on the fly
            'methods' => [
                'SetHeader' => ['Accurate (PVT) LTD.'],
                'SetFooter' => ['{PAGENO}'],
            ]
        ]);

        $pdf->filename = "Issue_Meter.pdf";
        // return the pdf output as per the destination setting
        return $pdf->render();
    }
    else{
        return $this->render('viewpdf', [
            'dataProvider' => $dataProvider,
            'searchModel' => $searchModel
        ]);
    }
}

```

**My view**

```
<div class="box-body">
       <form>
        <p>
            <a href="<?= URL::toRoute('issue/viewpdf') ?>" type="submit" class="btn btn-primary" id="dl" name="issue_pdf">Download PDF</a>
            <br/>
        </p>
        </form>  

      <?= GridView::widget([
         'dataProvider' => $dataProvider,
          'filterModel' => $searchModel,
        'columns' => [
        ['class' => 'yii\grid\SerialColumn'],
        [
            'label' => 'Store',
            'value' => function ($d) {
               if(is_object($d->store))
                return $d->store->name;
               return ' - ';
            },
            'filter' => Html::activeDropDownList($searchModel,'store_id',\app\models\Stores::toArrayList(),['prompt' => "Stores", 'class'=>'form-control']),
        ],
         'meter_serial',
        [
            'label' => 'Issuer',
            'value' => function ($d) {
                if(is_object($d->user))
                return $d->user->username;
                return ' - ';
            },
            'filter' => Html::activeDropDownList($searchModel, 'issuer', \app\models\User::toArrayList(), ['prompt' => "Users", 'class' => 'form-control']),

        ],
        ['class' => 'yii\grid\ActionColumn'],
    ],
]); ?>
    </div>

```

On clicking of the `Download PDF` it doesn't goes to the `if` condition in my controller.

Any help would be highly appreciated.