I am using force_download and everything works well except for the file being named 'file.pdf' and not 'Daily_delivery_sheet.pdf'. The pdf looks correct, it's just the filename that is wrong. I am stumped as to why this is happening.
In the next function in the same file, the code is exactly the same and it is working perfectly.
Here is my code:
$pdf = $mcccpdf->getPdf($data);
$this->load->helper('download');
$filename = 'Daily_delivery_sheet.pdf';
force_download($filename, $pdf);
exit;
It turns out that another programmer put $pdfobj->ezStream( array('compress' => 0 ) );
where the PDF was being generated and that was the cause of the problem. I removed it and everything works perfectly now.