One of the applications I’ve been working on generates PDF files which the customer can download. I’m using the FPDF and FPDI libraries to import PDFs and create copies with generated contents. This has been really easy to code, and it’s been working flawlessly in both Firefox and Safari. When we started testing under Internet Explorer thing started breaking. The problem was that IE would not let the user download the file. The only feedback we got was error messages like “The file is currently unavailable or cannot be found. Please try again later.” and “The file could not be stored in cache”. After spending some time debugging I found out that IE has problems with file downloads over HTTPS. Google pointed me to this post. The guy in that post spent six hours figuring it out, and he probably saved me six hours as well. The magic required to satisfy Internet Explorers needs:

1
2
header('Cache-Control: maxage=3600');
header('Pragma: public');

Spread the message so others can spare some time!

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DZone
  • Live
  • Slashdot

11 Responses to “Generated PDFs over HTTPS with Internet Explorer”

  1. Markus Says:

    Thank you! :-)

  2. tyler Says:

    you’re awesome.

  3. Roshan Says:

    Thank You :)

  4. eirikhoem Says:

    I’m just glad to spread the word :)

  5. Jerronimo Says:

    I love you man! You’re my god!

  6. Patrick Says:

    Awesome! I love M$ products! They’re so…. in need of repair ;)

  7. Brad Cupit Says:

    Oh man, you just saved me sooo much time! Thanks for the awesome post!

  8. Oz Says:

    Thank you!

  9. Dave Lewicki Says:

    Worked like a charm. THANKS!!!!!

  10. Populate PDF templates with PHP / FPDF / FPDI | Eirik Hoem's Blog Says:

    […] Related posts: Generated PDFs over HTTPS with Internet Explorer […]

  11. patricia Says:

    hi, I have the same problem but with java struts,and the code is that:
    response.setContentType(”application/pdf”);
    response.setHeader(”Content-Disposition”, “attachment;Cache;filename=\”" + ruta + “\”");

    Can you help me?

Leave a Reply