Sending PDF for download

Symptom: When sending a PDF for download to IE, the error message appears:

There was an error opening this document. The file could not be found.

Cache-Control has been set to no-cache. Firefox works fine.

Cause: Unknown, IE specific problem with cache handling.

Solution: Set expiry date to trick browser that content expired. [1]


response.setHeader("Expires", "0");
response.setHeader("Pragma", "cache");
response.setHeader("Cache-Control", "private");

[1] http://drupal.org/node/18179

Leave a Reply