[reportlab-users] Return a file object rather than save afile...

Roberto Alsina ralsina at netmanagers.com.ar
Fri Oct 2 08:15:23 EDT 2009


On Friday 02 October 2009 09:15:06 Andy Robinson wrote:

> 2009/10/2 Roberto Alsina <ralsina at netmanagers.com.ar>:

> > Isn't this faster?

> > buf = cStringIO.StringIO()

> > c=Canvas(buf)

> > #do your drawing

> > c.save()

> > rawPdfFileContent = buf.getvalue()

>

> It's certainly one line shorter and thus more elegant - thanks...


Also cStringIO is much, much faster when it works. It's not a perfect StringIO
replacement, but it works for reportlab.

--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)


More information about the reportlab-users mailing list