How do I continue a content to a next page in Reportlabs - Python

后端 未结 2 1135
野性不改
野性不改 2021-01-17 18:08

I\'m making a table, where the table can be either small or large depending upon the data being received.

While I was providing a huge data set, I noticed that altho

相关标签:
2条回答
  • 2021-01-17 18:22

    I'd advice using the more high-level primitives of reportlab, that is, document templates, frames and flowables. That way, you get splitting for "free". An example from the related questions

    0 讨论(0)
  • 2021-01-17 18:28

    Use table.split():

    from reportlab.lib.pagesizes import A4 # im using A4
    
    width, height = A4
    table_pieces = table.split(width, height)
    
    for table_piece in table_pieces:
        table_piece.drawOn(the_canvas, *coordinates)
        the_canvas.show_page()
    the_canvas.save()
    

    Tell me if it helped :)

    0 讨论(0)
提交回复
热议问题