diff -r 5b2cc88412f7 -r e098ee83b363 svv/pdf.py --- a/svv/pdf.py Thu Dec 23 18:20:26 2010 +0200 +++ b/svv/pdf.py Thu Dec 23 19:56:44 2010 +0200 @@ -420,9 +420,9 @@ pageSize=page_size ) - def render_string (self, elements) : + def render_buf (self, elements) : """ - Build the document using the given list of Flowables, returning the PDF as a single str. + Build the document using the given list of Flowables, returning a StringIO containing the PDF. """ buf = StringIO() @@ -430,6 +430,19 @@ # build self.build(elements, buf) + # prepare for read + buf.seek(0) + + return buf + + def render_string (self, elements) : + """ + Build the document using the given list of Flowables, returning the PDF as a single str. + """ + + # render + buf = self.render_buf(elements) + # binary data out return buf.getvalue()