Finally got some PHP header to force IE to display the PDF document right
from the file from the server.  Due to most of IE bugs, this script will
help.  It can be either getting a file from the webserver as this script is
or you can change the PHP header to use the attachment instead.

--snip--
<?
    $filename=$_REQUEST['PDF_FileName'];
    $filepath=$_REQUEST['PDF_FilePath'];

    $filesize=filesize($filepath);

    header("Pragma: public");
    header("Expires: 0"); // set expiration time
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

    header("Content-Type: application/pdf");
    header("Content-Length: ".$filesize);
    header("Content-Disposition: inline; filename=$filename");
    header("Content-Transfer-Encoding: binary");

    //Can't use readfile() due to poor controlling of the file download.
    //(IE have this problems)...
    //readfile($filepath);

    //use fopen() instead of readfile...
    $fp = fopen($filepath, 'rb');
    $pdf_buffer = fread($fp, $filesize);
    fclose ($fp);

    print $pdf_buffer;

    //Required, to keep IE from running into problems
    //when opening the file while downloading or downloading...
    //(IE been acting strange...)
    exit();
?>
--snip--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to