I found this in the docs
and am trying to create an action to download a view as a PDF
in my action i have this
function actionDownload() {
$content = $this->render('@app/modules/bla/views/view', [
'model' => $model,
]);
$filename =' bla.pdf';
return \Yii::$app->response->sendContentAsFile($content, $filename, ['mimeType' => 'application/pdf'])->send();
}
when the pdf is saved to my downloads folder, i can’t open it. does sendContentAsFile()
not save as a PDF? or am i missing something in the options
?