У меня есть Kartik mpdf, который не позволяет мне просматривать PDF, но заставляет меня скачивать.Как я могу заставить его открыться в браузере вместо загрузки.
$pdf = new Pdf([
// set to use core fonts only
'mode' => Pdf::MODE_CORE,
// A4 paper format
'format' => Pdf::FORMAT_A4,
// 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/src/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' => "Sales report"],
// call mPDF methods on the fly
'methods' => [
'SetHeader' => ["Sales Report"],
'SetFooter' => ['{PAGENO}'],
]
]);
return $pdf->render();
Тоже пробовал
Yii::$app->response->headers->set('Content-Type', 'application/pdf');
$file = $user.'.pdf';
Yii::$app->response->headers->set('Content-Disposition', 'inline;filename="'.$file.'"');