[Zope] IE and HTML pdf's generated on the fly

Dennis Allison allison@sumeru.stanford.EDU
Tue, 15 Oct 2002 08:40:25 -0700


fredz@pimentech.net wrote Tue Oct 15 02:28:32 2002:
> 
> Wrong.
> I've done pdf generation on the fly with an external method :
> 
> Headers :
> 	REQUEST.RESPONSE.setHeader('Content-Length',len(pdfoutput))
> 	REQUEST.RESPONSE.appendHeader('Content-Type','application/pdf')
> External method :
> choose an id with .pdf extension ; that's the only real method for that 
> buggy Internet Exploder.
> 
> Of course, this also works with Mozilla, Netscape, Opera, Konqueror ...
> 

Frederic,

Thanks for your comment.  I'd like to rationalize your experience with mine
and that of other list responses.  I believe that your comments apply to 
the situation where the client makes an explicit request for a pdf document.
Is my supposition correct?

My case is a bit different.  In my case, the clent provides a description
of the document he wants via a form, and a pdf document is served, but there 
is no explicit request--it's just the response from submitting the form.
IE appears to get confused by this, the other browsers do not.  

The solution appears to be to use a bit of redirection/refresh  magic.  
The form iaction does not compute and serve the pdf, rather it generates a page
that refreshes and redirects itself to a page that computes and serves the pdf,
effectively arranging for the clent to request a pdf rather than sending 
non-html material unannounced.