[reportlab-users] Generating PDF via StringIO

hanifa mohamed hanifa_email at yahoo.com.sg
Thu Dec 28 20:12:46 EST 2006

Hi fellars,
Firstly, I would like to say that I am really pleased with reportlab for being able to generate barcodes.
Now let me proceed with my question,Users can generate PDF documents in web site(btw it is Plone) and then they can print them or etc. But here's the catch, my boss strictly does not want me to create the PDF files on the filesystem and instead to generate them on the fly.

For images i have previously done this ,

im=PILImage.fromstring('RGB', size, buf, 'raw', 'RGB', 0, 1)
im.save(imgdata, 'PNG')
self.REQUEST.RESPONSE.setHeader('Pragma', 'no-cache')
self.REQUEST.RESPONSE.setHeader('Content-Type', 'image/png')

return imgdata.getvalue()

But currently, here is how i generate the PDF docs in report lab.
'''Filling up story'''
doc = MyDocTemplate(outputfile(self.filename))
Anyone knows how I can modify these code by using StringIO instead of filename.I have tried out but am unable to get anywhere.Any hinters or help whatsoever will indeed be very helpful.

Thanks in advance guys.

Send instant messages to your online friends

Send instant messages to your online friends http://asia.messenger.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20061228/a26c0e21/attachment.html

More information about the reportlab-users mailing list