kartik-v / yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.
http://demos.krajee.com/mpdf
Other
161 stars 150 forks source link

How to Download PDF file from link #107

Closed luongit closed 4 years ago

luongit commented 4 years ago

I want to automatically download the file instead of displaying it in a browser Please help me Thanks you !

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/89243687-how-to-download-pdf-file-from-link?utm_campaign=plugin&utm_content=tracker%2F7843555&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F7843555&utm_medium=issues&utm_source=github).
luongit commented 4 years ago

public function actionPdf(){ $pdf = new Pdf([ 'mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_DOWNLOAD, //DEST_FILE, DEST_BROWSER, DEST_DOWNLOAD 'filename' => 'This is the filename', 'content' => $content,
'marginLeft' =>15, 'marginRight' =>15, 'marginTop' =>15, 'marginBottom' =>15, 'marginHeader' =>5, 'marginFooter' =>10, 'options' => ['title' => 'This is the title'], 'methods' => [ 'SetHeader' => ['||On: ' . date("r")], 'SetFooter'=>['{PAGENO}'], ] ]); return $pdf->render(); }

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.