public function actionPdf()
    {
        $this->getSearchCriteria();
        $this->layout = static::BLANK_LAYOUT;
        $this->dataProvider->pagination = false;
        $content = $this->render('pdf', [
            'dataProvider' => $this->dataProvider,
        ]);
        if (isset($_GET['test'])) {
            return $content;
        } else {
            $mpdf = new \mPDF();
            $mpdf->WriteHTML($content);

            Yii::$app->response->getHeaders()->set('Content-Type', 'application/pdf');
            Yii::$app->response->getHeaders()->set('Content-Disposition', 'attachment; filename="' . $this->getCompatibilityId() . '.pdf"');
            return $mpdf->Output($this->getCompatibilityId() . '.pdf', 'S');
        }
    }
public function actionPdf()
    {
        $this->getSearchCriteria();
        $this->layout = static::BLANK_LAYOUT;
        $this->dataProvider->pagination = false;
        $content = $this->render('pdf', [
            'dataProvider' => $this->dataProvider,
        ]);
        if (isset($_GET['test'])) {
            return $content;
        } else {
            $mpdf = new \mPDF();
            $mpdf->WriteHTML($content);

            Yii::$app->response->getHeaders()->set('Content-Type', 'application/pdf');
            Yii::$app->response->getHeaders()->set('Content-Disposition', 'attachment; filename="' . $this->getCompatibilityId() . '.pdf"');
            return $mpdf->Output($this->getCompatibilityId() . '.pdf', 'S');
        }
    }
public function actionPdf ( ) { $ this -> getSearchCriteria ( ) ; $ this -> layout = static :: BLANK_LAYOUT ; $ this -> dataProvider -> pagination = false ; $ content = $ this -> render ( 'pdf' , [ 'dataProvider' => $ this -> dataProvider , ] ) ; if ( isset ( $ _GET [ 'test' ] ) ) { return $ content ; } else { $ mpdf = new \ mPDF ( ) ; $ mpdf -> WriteHTML ( $ content ) ; Yii :: $ app -> response -> getHeaders ( ) -> set ( 'Content-Type' , 'application/pdf' ) ; Yii :: $ app -> response -> getHeaders ( ) -> set ( 'Content-Disposition' , 'attachment; filename="' . $ this -> getCompatibilityId ( ) . '.pdf"' ) ; return $ mpdf -> Output ( $ this -> getCompatibilityId ( ) . '.pdf' , 'S' ) ; } }
Creates a PDF file with the current list of the models
@return string
Creates a PDF file with the current list of the models