Hello all, after _much_ wailing and gnashing of teeth, i am now happily churning out PDF reports via reportlab/ external methods, but i still have one irritation: i am using a tempfile.mktemp(suffix=".pdf") object to chuck the pdf into but am having trouble responsing this back to the browser cleanly. i am using this code (thx, messrs Washington + Penny!): c.save() self.REQUEST.RESPONSE.setHeader('Content-type', 'application/x-pdf') self.REQUEST.RESPONSE.write(open(mypdffile).read()) but the tempfile object seems to get mangled somewhere in the process and the client doesn't recognise the file as PDF because the PDF suffix gets lost somewhere... any help most welcome... if anyone wants to enlighten me regarding what ext methods can or should return, i would also be grateful! i would like to write a HOWTO on reportlab + zope once i've got this stuff finished... cheers, garry __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/
Hi Garry! --On Montag, 07. Jänner 2002 10:10 -0800 Garry Steedman <garry_steedman@yahoo.com> wrote:
i would like to write a HOWTO on reportlab + zope once i've got this stuff finished...
A HOWTO on Reportlab and Zope is very much appreciated! Please post a message when its published. Thnx Juergen
Garry Steedman writes:
after _much_ wailing and gnashing of teeth, i am now happily churning out PDF reports via reportlab/ external methods, but i still have one irritation: i am using a tempfile.mktemp(suffix=".pdf") object to chuck the pdf into but am having trouble responsing this back to the browser cleanly.
i am using this code (thx, messrs Washington + Penny!):
c.save() self.REQUEST.RESPONSE.setHeader('Content-type', 'application/x-pdf') self.REQUEST.RESPONSE.write(open(mypdffile).read())
but the tempfile object seems to get mangled somewhere in the process and the client doesn't recognise the file as PDF because the PDF suffix gets lost somewhere... any help most welcome... Is it possible that your tempfile has not yet been closed after writing?
It is not a good idea to write to a file and then open it for reading without an intervening "close" (because part of the "written" data may still wait in internal buffers to be flushed to disk). Dieter
participants (3)
-
Dieter Maurer -
Garry Steedman -
Juergen R. Plasser / HEXAGON