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->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?

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

it get solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.