Problem Creating NewLines in PDF
Andrew Evans
randrange at gmail.com
Wed Aug 18 12:49:53 EDT 2010
Hello I am generating a PDF in web2py but its ignoring my line breaks.
randname = random.randrange(1, 10001)
styles = getSampleStyleSheet()
title = "My Title"
doc = SimpleDocTemplate("primer.pdf")
story = []
story.append(Paragraph(strftime("%a, %d %b %Y %H:%M:%S",
gmtime()),styles["Heading2"]))
para = ParagraphStyle(name="output", fontName='Helvetica',
fontSize=12)
story.append(Paragraph(str(result_list), para))
doc.build(story)
response.headers['Content-Type']='application/pdf'
response.headers['Content-Disposition'] =
'attachment;filename='+str(randname)+'-.pdf'
return response.stream(open("primer.pdf", 'rb'))
result_list is a generated list. The pdf ignores line breaks and outputs it
as a list so [' '] are included also. Any idea how I can create line breaks
and get rid of the [' ']
*cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100818/22456c58/attachment.html>
More information about the Python-list
mailing list