0
我的工作SiteController動作打印,這裏是我的代碼Yii2 MPDF變化下載的文件名
$pdf = new Pdf([
// set to use core fonts only
'mode' => Pdf::MODE_UTF8,
// A4 paper format
'format' => Pdf::FORMAT_A4,
// portrait orientation
'orientation' => Pdf::ORIENT_PORTRAIT,
// stream to browser inline
'destination' => Pdf::DEST_BROWSER,
'marginTop' => 5,
'marginLeft' => 5,
// 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' => 'Customer Invoice'],
// call mPDF methods on the fly
'methods' => [
// 'SetHeader'=>['Krajee Report Header'],
// 'SetFooter'=>['{PAGENO}'],
]
]);
// return the pdf output as per the destination setting
return $pdf->render();
當這個動作被觸發,它呈現在瀏覽器上的PDF,但是當我點擊下載按鈕默認文件名是「打印」。我該如何改變它?
請幫忙!!!
[使用MPDF時更改默認的文件名]的可能的複製(https://stackoverflow.com/questions/34687293/changing-the-default-filename-when-using-mpdf) – Yupik
我可以知道是什麼這個腳本''options'=> ['title'=>'客戶發票'],'for?我在我的文件中設置了這樣的腳本,但它並沒有在任何地方顯示**客戶服務**。謝謝 – Blackjack