如何将框架的内容流到reportlab中的下一页?

时间:2019-06-27 08:54:46

标签: python django python-3.x pdf reportlab

我在定义坐标的页面中有框架。我想在其中画一张桌子。当表格高位溢出时,我要在下一页上溢出高度内容。

c = canvas.Canvas(response)
content = []

con = all_local.other_particular.splitlines()
y = 100
i = 0
for row in con:
    c.drawString(130, y, con[i])
    y = y-10
    i = i+1

styleN = ParagraphStyle('parrafos',
                   # alignment=TA_CENTER,
                   fontSize=8,
                   fontName="Times-Roman")
mark_no = Paragraph(str(all_local.mark_and_nos).replace('\n', '<br 
/>\n'), styleN)
disc_goods = 
Paragraph(str(all_local.description_of_goods).replace('\n', '<br 
/>\n'), styleN)

data= [[mark_no, disc_goods, '02', '03', '04'],
       ['10', '11', '12', '13', '14'],]
t=Table(data)
t.setStyle(TableStyle([('BACKGROUND',(1,1),(-2,-2),colors.green),
                       ('TEXTCOLOR',(0,0),(1,-1),colors.red),
                       ]))
content.append(t)

f = Frame(30, 160, 530, 210, leftPadding=6, bottomPadding=6, 
rightPadding=6, topPadding=6, id=None, showBoundary=1)
f.addFromList(content, c)


c.showPage()
c.save()

我希望表格可以按框架打印,其余表格内容打印在下一页。

0 个答案:

没有答案