Skip to content

Instantly share code, notes, and snippets.

@korrio
Created October 5, 2019 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korrio/a898871e5d14dc45d3c5421c0351a307 to your computer and use it in GitHub Desktop.
Save korrio/a898871e5d14dc45d3c5421c0351a307 to your computer and use it in GitHub Desktop.
topdf.php
<?php
session_start();
if($_SESSION['open'])
{
header("Content-type:application/pdf");
header("Cache-Control: maxage=1");
header("Pragma: public");
//if(ae_detect_ie())
//{
// It will be called downloaded.pdf
header("Content-Disposition:attachment;filename=PrintPDF.pdf");
//}
// The PDF source is in original.pdf
readfile("ajax/pdftemp.pdf");
session_destroy();
}
function ae_detect_ie()
{
if (isset($_SERVER['HTTP_USER_AGENT']) &&
(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
return true;
else
return false;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment