Cannot view PDF in IE (PDF builded with PDFLib)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • myth0s
    New Member
    • Jan 2008
    • 32

    Cannot view PDF in IE (PDF builded with PDFLib)

    Hi All,

    I am dumbfounded with a problem that happens only in IE (7.0, I don't know for the other versions).

    Situation :
    I have a .php file that builds dynamically (with PDFLib) a PDF. I can see that PDF with Firefox, but not with IE7.

    When I click the link to open the PDF in a new window, all I get is a blank page. Also, if I have a website opened and I type the address of the .php file that builds the PDF in the address bar, the page will not change. IE will continue to display the "old" page, even though I can see the "www.whatever.c om/printPDF.php" in the address bar. If I click refresh at that point, it will refresh the old website.

    When I have the blank page (in a new window) I can click Page -> Save As and that will download the PDF like if everything is fine!!

    If I click the link or if I enter the address of the .php file in Firefox, everything works fine O.o

    The header I have are :

    [PHP]
    $buf = $p->get_buffer() ;
    $len = strlen(ltrim($b uf));

    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires : Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    header("Content-type: application/pdf");
    header("Content-Length: $len");
    header("Content-Disposition: inline;");
    header("Pragma: public");

    echo $buf;[/PHP]

    Note, before I removed "filename= ..." after "inline" in Content-disposition, it wasn't working with Firefox either.

    If anyone has a guess at what may be the problem, I would really like to hear it!

    Thank you.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Mythos.

    Check out some of the headers set on the example on this page. There is one line in particular that is noted as "required for some browsers". I wonder if one of them is IE....

    Comment

    Working...