Jim Steil
jim at qlf.com
Mon Oct 16 15:15:53 EDT 2006
It runs my script, but doesn't go anywhere when it is done. The code looks like this: --------------------- # Create the document. reportPeriod = 'Report for the Month of %s %s' % (months[reportMonth], reportYear) output = StringIO.StringIO() doc = SimpleDocTemplate(output, pagesize=landscape(letter)) doc.m = reportPeriod go(doc, reportMonth, reportYear) # Return the rendered page content. content = output.getvalue() req.content_type = "application/pdf" req.headers_out['Content-Length'] = str(len(content)) # Internet Explorer chokes on this with PDFs. #req.headers_out['Pragma'] = 'no-cache' #req.headers_out['Cache-Control'] = 'no-cache' #req.headers_out['Expires'] = '-1' req.send_http_header() req.write(content) return apache.OK --------------------- This works fine in Firefox, but doesn't do anything in IE. The comment in the code about Internet Explorer choking was there in Grahams example. I looked at the link you provided, but it seems to speak about doing a Save As when you display the content. That is not what I'm trying to accomplish. I want the pdf to come back to the screen, but have it come back with a name. -Jim -----Original Message----- From: Colin Bean [mailto:ccbean at gmail.com] Sent: Monday, October 16, 2006 2:05 PM To: Jim Steil Cc: mod_python at modpython.org Subject: Re: [mod_python] ReportLab integration Hi Jim, How does it break in IE? If it it won't recognize the result is a pdf, try setting the content-disposition header. You can use this to specify a filename that browser will save your file as; if you give it a .pdf extension then IE should open it fine. Here's a little more info on it: http://support.microsoft.com/kb/260519 I *think* that changing your handler to use a .pdf extension will do the same thing (I haven't used publisher yet so I'm not sure how to do this); the content disposition trick might be easier, though. -Colin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20061016/5e170c04/attachment-0001.html
|