[Zope] Zope pdf's on the fly

Toni Andjelkovic toni@soth.at
Wed, 9 Jul 2003 21:29:11 +0200


On Mon, Jul 07 2003 (10:55:48 -0700), Dennis Allison wrote:
> Yes, I set them properly.  Unfortunately IE ignores them <sigh!>.

Some time ago I've had similar problems with MSIE 6 downloading a
dynamically created Excel document. Eventually, I've been able to
solve it as follows. Unfortunately, it's not Zope but HTML::Mason,
but you might be able to adapt it to meed your demands ;-)

The component is called "dumpExcel.mhtml", so it's not necessary
to give it an .xls extension.


# Clear Mason buffer and HTTP headers.
$m->clear_buffer();
$r->headers_out->clear();
# Set the content type and filename.
$r->content_type("application/vnd.ms-excel");
$r->header_out("Content-disposition", 'inline;filename="Data.xls"');
# Internet Explorer 6 SP1 blows up when it encounters an "Expires"
# HTTP header with a past date. The content of "Expires" is set to
# time() - 1 hour when calling no_cache(1). Disable this behaviour.
$r->no_cache(0);
# Send the Response headers (Doh).
$r->send_http_header();

# Write the response body
...



HTH,
Toni