Reputation: 55
So i got this doc that is converted to .pdf using mPDF. But I cant seem to figure out how to change the name of the .pdf file by using a variable.
Right now mPDF uses this code to generate the .pdf and the name which here is just plain "filename.pdf"
$mpdf->Output('filename.pdf','D');
But i need the name to use a variable so the name is uniqe each time. I got the variable $counter that has a number that changes with each pdf, and i would like that to be the name og the .pdf combined with the variable $date
So that the name of the pdf would be somthing like 1852-12-03-2015.pdf
Any way to make this possible with mPDF?
Upvotes: 0
Views: 310
Reputation: 2128
try this..
rand(1000,9999)
used for generating random number of 4 digits
$mpdf->Output(<?php echo rand(1000,9999).'-'.date('d-m-y').'.pdf'; ?>,'D');
Upvotes: 1