Dynamic mpdf filename

I am trying to create dynamic pdf file names based on the user who is logged in using mpdf

now in my mind this (or something similar) should work – but doesn’t.

$User = $_POST ['Username']
$filename = $User
$Extension = ".pdf";

$mpdf->Output($filename, $Extension ,'F');

Which returns the error:

mPDF error: Incorrect output destination: .PDF

and

$mpdf->Output($filename $Extension ,'F');

or

$mpdf->Output($filename$Extension ,'F');

doesn’t create the file.

This

$mpdf->Output($filename,'F');

creates the file but without the .pdf extension

Help?


Source: syntax

Leave a Reply