RE: [PHP] Re: Displaying PDF file
| From: | Matt Schroebel | Date: | Thu, 12 Sep 2002 19:12:18 +0000 |
| Subject: | RE: [PHP] Re: Displaying PDF file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116197@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Erwin [mailto:erwin@isiz.com]
> Sent: Thursday, September 12, 2002 11:02 AM
> To: php-general@lists.php.net
> Subject: [PHP] Re: Displaying PDF file
>
>
> Joseph Szobody wrote:
> > Thanks Erwin, that helps.... but I'm still not getting it to work.
> > Should I still use the ....
> >
> > Header("Content-type: application/pdf");
> >
> > line?
> >
> > I tried using readfile() keeping the header. When I click
> the link to
> > the PHP script that should show me the PDF, the IE status bar says
> > something like "Downloading from site .....blah", then says "Done".
> > Nothing happens. I'm still on the previous page. No error, no pdf
> > file... nothing.
Send these three headers:
header('Content-type: application/pdf');
header("Content-Disposition: inline; filename=$file");
header("Content-Length: $length");
You need to send the length of the document, so use filesize() to get it.
Also, if you had an error in the script, close the browser window and then re-open it and browse to
the page again.
Lastly, IE changes a POST request to a GET request on a pdf document, so you can't hit refresh
on the POSTed to page. If that's what you're going, you might want to consider changing
the POST to a GET ...