0

Hello,
As using Yii's mpdf() extenstion for generating pdf file.
code is as below:

$mPDF1 = Yii::app()->ePdf->mpdf();
$stylesheet = file_get_contents(Yii::getPathOfAlias('webroot.css') . '/screen.css');
$mPDF1->WriteHTML($stylesheet, 1);
$Arraylist= array('employee_gslab_id'=>$employee_gslab_id,'other_details'=>$employee_details);
$mPDF1->WriteHTML($this->renderPartial('address_proof',$Arraylist,true));
$mPDF1->Output($name, EYiiPdf::OUTPUT_TO_DOWNLOAD);

everything is working as expected except when this file is downloaded/saved then it is not showing extesion to file.
how can I add (.pdf) extension to it?

1
Contributor
1
Reply
3
Views
2 Years
Discussion Span
Last Post by Priti_P
0

Hello,
So stupid I was,
I just changed line
$mPDF1->Output($name, EYiiPdf::OUTPUT_TO_DOWNLOAD);
to
$mPDF1->Output($name.".pdf", EYiiPdf::OUTPUT_TO_DOWNLOAD);

it get solved!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.