[reportlab-users] Generating PDF via StringIO

hanifa mohamed hanifa_email at yahoo.com.sg
Thu Dec 28 21:27:13 EST 2006


Hi after a whole day, I finally got it,with some help from this website.
http://wiki.w4py.org/pdf-creation-with-reportlab.html?version=1
Regards


----- Original Message ----
From: hanifa mohamed <hanifa_email at yahoo.com.sg>
To: reportlab-users at reportlab.com
Sent: Friday, 29 December 2006 9:12:46 AM
Subject: Generating PDF via StringIO

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)
imgdata=StringIO()
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.
story=[]
'''Filling up story'''
doc = MyDocTemplate(outputfile(self.filename))
doc.multiBuild(story)
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.
Regards.






Send instant messages to your online friends
http://asia.messenger.yahoo.com




Send instant messages to your online friends http://asia.messenger.yahoo.com




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/f47fc3b8/attachment-0001.html


More information about the reportlab-users mailing list