equal
deleted
inserted
replaced
418 rlpp.BaseDocTemplate.__init__(self, filename=None, |
418 rlpp.BaseDocTemplate.__init__(self, filename=None, |
419 pageTemplates=page_templates, title=title, author=author, |
419 pageTemplates=page_templates, title=title, author=author, |
420 pageSize=page_size |
420 pageSize=page_size |
421 ) |
421 ) |
422 |
422 |
423 def render_string (self, elements) : |
423 def render_buf (self, elements) : |
424 """ |
424 """ |
425 Build the document using the given list of Flowables, returning the PDF as a single str. |
425 Build the document using the given list of Flowables, returning a StringIO containing the PDF. |
426 """ |
426 """ |
427 |
427 |
428 buf = StringIO() |
428 buf = StringIO() |
429 |
429 |
430 # build |
430 # build |
431 self.build(elements, buf) |
431 self.build(elements, buf) |
432 |
432 |
|
433 # prepare for read |
|
434 buf.seek(0) |
|
435 |
|
436 return buf |
|
437 |
|
438 def render_string (self, elements) : |
|
439 """ |
|
440 Build the document using the given list of Flowables, returning the PDF as a single str. |
|
441 """ |
|
442 |
|
443 # render |
|
444 buf = self.render_buf(elements) |
|
445 |
433 # binary data out |
446 # binary data out |
434 return buf.getvalue() |
447 return buf.getvalue() |
435 |
448 |