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

Carl Karsten carl at personnelware.com
Mon Oct 5 01:13:02 EDT 2009


http://bazaar.launchpad.net/~mdipierro/web2conf/devel/annotate/head%3A/controllers/badge.py#L105

The important bits:

# buffer to create pdf in
buffer = StringIO()

# generate the pdf in the buffer, using the layout and data
rw = dReportWriter(OutputFile=buffer, ReportFormFile=xmlfile, Cursor=ds)
rw.write()

# get the pdf out of the buffer
pdf = buffer.getvalue()
buffer.close()

return pdf


On Sun, Oct 4, 2009 at 11:35 PM, Brower Jason <Jason.Brower at kone.com> wrote:

> I would love to see it.  But it's a lot of data to sift through.

> Regards,

> Jason Brower

>

> -----Original Message-----

> From: reportlab-users-bounces at lists2.reportlab.com [mailto:reportlab-users-bounces at lists2.reportlab.com] On Behalf Of Carl Karsten

> Sent: 02/10/2009 15:42

> To: For users of Reportlab open source software

> Subject: Re: [reportlab-users] Return a file object rather than save afile...

>

> On Thu, Oct 1, 2009 at 11:38 PM, Brower Jason <Jason.Brower at kone.com> wrote:

>> After a look through the main documentation I found section 2.2 and it

>> shoulds how to open a file like object and insert a pdf into that.  But I

>> would like to have just the file object itself to return as a downloadable

>> stream. (I am using web2py)

>>

>

> I wrote code like that a year ago.  It is here:

>

> http://bazaar.launchpad.net/~mdipierro/web2conf/devel

> but right now I get

> "Sorry, there was a problem connecting to the Launchpad server. "

>

> so I can't find the exact place.  Look for the dabo report writer

> stuff.  That is a reportlab wrapper, but the parts you want is the

> same.

>

> --

> Carl K

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

>




--
Carl K


More information about the reportlab-users mailing list