[reportlab-users] Building/Storing PDF's in memory

J. R. Carroll jrcarroll at jrcresearch.net
Thu Dec 27 11:32:25 EST 2012


Thanks Andy.

Which, is exactly what I am trying to do (web request).


----


J. R. Carroll
Independent Researcher through Hurtz Labs
Research Methods, Test Development, and Statistics
www.jrcresearch.net
www.ontvp.com
Cell: (650) 776-6613
Email: jrcarroll at jrcresearch.net
jrcarroll at hurtzlab.com
jrc.csus at gmail.com
<https://www.facebook.com/J.R.Car>
<https://twitter.com/jNammer><http://www.linkedin.com/in/jrcarroll>



On Thu, Dec 27, 2012 at 11:25 AM, Andy Robinson <andy at reportlab.com> wrote:


>

> On 27 December 2012 16:03, J. R. Carroll <jrcarroll at jrcresearch.net>wrote:

>

>> Hi Andy,

>>

>> Thanks - that would be great. I am currently using Canvas, but see

>> myself doing some platypus work very soon as I am generating quite a few

>> reports. If you have examples for both that would help quite a bit, but if

>> not, Canvas is preferred.

>>

>>

> Going from (my own, human) memory here...

>

> buf = StringIO.StringIO()

>

> c = Canvas(buf)

> c.drawString(100,100, 'Hello world')

> c.save()

>

>

> raw_pdf_content = buf.getvalue()

>

>

> In Platypus, wherever you would pass in the file name, do the same thing.

>

> A very common use for this pattern is to send files as a response from a

> web request without ever saving them to disk.

>

>

>

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

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

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20121227/60dd26f8/attachment-0001.htm>


More information about the reportlab-users mailing list