i want to download a html page into a pdf file. i'm using Codeigniter.
This is my code:
<?php
if($type==0)//excel
{
$mime="vnd.ms-excel";
$format=".xls";
}
else if($type==1)//pdf
{
$mime="pdf";
$format=".pdf";
}
header('Content-Type: application/'.$mime.'');
header('Content-Disposition: attachment; filename="Placeout'.$format.'"');
header("Content-Transfer-Encoding: binary");
header('Accept-Ranges: bytes');
/* The three lines below basically make the download non-cacheable */
header("Cache-control: private");
header('Pragma: private');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
?>
<html>
<body>
..........
</body>
</html>
When i export into an excel file, it works. But when i'm exporting into a pdf file, it download the file but i can't open the file. when i open the file it shows a message: This is the message from adobe reader...
Also, can you explain the last three header line(the non-cacheable thing). Thank you for your answer..