Reportlab pdf печатает только одну страницу
Я могу создать таблицу в reportlab, как показано ниже, но она печатается только на одной странице, как я могу распечатать данные на нескольких страницах
def pdf_view(request):
enc = pdfencrypt.StandardEncryption("pass", canPrint=0)
buf = io.BytesIO()
c = canvas.Canvas(buf, encrypt=enc)
width, height = A4
textob = c.beginText()
textob.setTextOrigin(inch, inch)
textob.setFont("Helvetica", 14)
lines = []
users = User.objects.filter(is_staff=False)
for user in users:
lines.append(user.username)
lines.append(user.email)
lines.append(user.first_name)
table = Table(lines, colWidths=10 * mm)
table.setStyle([("VALIGN", (0, 0), (-1, -1), "MIDDLE"),
("ALIGN", (0, 0), (-1, -1), "CENTER"),
('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black)])
table.wrapOn(c, width, height)
table.drawOn(c, 0 * mm, 5 * mm)
styles = getSampleStyleSheet()
ptext = "This is an example."
p = Paragraph(ptext, style=styles["Normal"])
p.wrapOn(c, 50 * mm, 50 * mm) # size of 'textbox' for linebreaks etc.
p.drawOn(c, 0 * mm, 0 * mm) # position of text / where to draw
c.save()
buf.seek(0)
return FileResponse(buf, as_attachment=True, filename='users.pdf')