> I have searched the net, and found tons of developers with different
> solutions to this problem, none of which I have found to work.
>
> What should the headers be for a client to download a PDF document and
> have it open using adobe i.e. pluggin??
>
> Here is code I am using, it works on some versions of I.E., but not all:
>
>
> $pdfdoc = $__BASE_PDF_BUILD_DIRECTORY.$_GET['FID'];
>
> $filesize = filesize($pdfdoc);
> header("Pragma: ");
> header("Expires: 0");
> 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=FILE.pdf");
> header("Content-Transfer-Encoding: binary");
> header("Accept-Ranges: bytes");
>
> readfile($pdfdoc);
> exit();
>
>
> Why isn't it working?
>
> Thanks,
>
> -Paul
>
If you attempting this over a secure connection (which I assume is why
you're having so much trouble) I.E. can be pretty gay. If it is over a
secure connection, it has to do with I.E. not being able to write to cache
or something. I forgot -- I ran into this a while back. If it's not over a
secure connection, I.E. is still gay. :-)

Try this:

header('Content-Type: application/pdf');
header('Content-Length: '.$filesize);
header('Content-Disposition: inline; filename=FILE.pdf');
header("Cache-Control: private");
header("Pragma: public");

readfile($pdfdoc);
exit();

When all else fails - force a download:

if(isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) &&
    strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'],'MSIE'))
    header('Content-Type: application/force-download');
else
    header('Content-Type: application/octet-stream');
header('Content-Length: '.$filesize);
header('Content-Disposition: inline; filename=FILE.pdf');
header("Cache-Control: private");
header("Pragma: public");


Jim Grill

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

Reply via email to