kartik\grid\controllers\ExportController::generatePDF PHP Method

generatePDF() protected method

Generates the PDF file
protected generatePDF ( string $content, string $filename, array $config = [] ) : void
$content string the file content
$filename string the file name
$config array the configuration for yii2-mpdf component
return void
    protected function generatePDF($content, $filename, $config = [])
    {
        unset($config['contentBefore'], $config['contentAfter']);
        $config['filename'] = $filename;
        $config['methods']['SetAuthor'] = ['Krajee Solutions'];
        $config['methods']['SetCreator'] = ['Krajee Yii2 Grid Export Extension'];
        $config['content'] = $content;
        $pdf = new Pdf($config);
        echo $pdf->render();
    }