del3d
Май 21, 2011 19:20:18
Здравствуйте!
Можно ли заставить переносить выводимый текст на следующую строку, когда достигнута правая граница страницы?
ИЛИ
Есть ли мануал по reportlab на русском?
mutabor
Июль 21, 2011 16:13:46
Присоединяюсь к вопросу. Есть код который формирут pdf.
from reportlab.pdfbase import pdfmetrics
from cStringIO import StringIO
from reportlab.lib.pagesizes import letter, A4
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image, Table, TableStyle
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib import colors
from reportlab.lib.units import cm, inch
def print1(request):
response = HttpResponse(mimetype='application/pdf')
response = ‘attachment; filename=3.pdf’
temp = StringIO()
doc = SimpleDocTemplate(temp, pagesize=A4, rightMargin=72, leftMargin=72, topMargin=100, bottomMargin=72)
Catalog =
styles = getSampleStyleSheet()
header = Paragraph(“Super”, styles)
Catalog.append(header)
style = styles
headings = ('Privet', ‘Zdorovo’)
allproducts = ()
t = Table( + allproducts)
t.setStyle(TableStyle(
[('GRID', (0,0), (1,-1), 2, colors.black),
('LINEBELOW', (0,0), (-1,0), 2, colors.white),
('BACKGROUND', (0, 0), (-1, 0), colors.pink)]))
Catalog.append(t)
doc.build(Catalog)
response.write(temp.getvalue())
temp.close()
return response
Подскажите как определить для Paragraph style wordWrap=true, чтобы переносить слова при достижении границы ячейки