For some reason this is not forcing a download of binary data that represents a pdf file? What am I doing wrong?
$tracking_number = 1;
$data = $this->OrderHistory->labelRecovery->makeSoapRequest($tracking_number);
$reportFileName = “Jason”;
$this->layout = 'bare';
ob_clean();
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: no-cache");
header("Cache-Control: public");
header('Content-Type: application/pdf');
//header('Content-Disposition: inline; filename=' . $reportFileName . '.pdf');
ob_start();
$myfile = fopen('php://output', 'w');
fwrite($myfile, $data);
flush();
$out = ob_get_clean();
header("Content-Length: " . strlen($out));
echo $out;
fclose($myfile);
exit;