This has been asked to some degree before but there are no solutions or accepted answers and I\'d like to try and be more comprehensive in my question so:
I\'m tryin
You may want to set up proper headers and set it to application/pdf as well as setting it to inline so that people can see it in their browsers (almost every recent browser supports this) and save it if they want. This is the code that I'm using:
exec("/usr/local/bin/wkhtmltopdf ../uploads/test.pdf");
$file = "../uploads/test.pdf";
$pdf = file_get_contents("../uploads/test.pdf");
header('Content-Type: application/pdf');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Length: '.strlen($pdf));
header('Content-Disposition: inline; filename="'.basename($file).'";');
ob_clean();
flush();
echo $pdf;
?>