I am dealing with generating a PDF from a huge data list.
There is no fancy styling or formatting involved. It's just that the data is a huge list (about 500 rows and 500 columns). Here is my code. Currently it will have no problem splitting rows across multiple pages depending on the page size, but the columns are being cut off since 500 columns don't fit in one page. I would also like to split columns across different pages as well. Each cell entry is just an integer. How can I achieve that?
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.lib.pagesizes import A0
from reportlab.platypus import SimpleDocTemplate, LongTable, TableStyle
elements = []
doc = SimpleDocTemplate(output, pagesize=A0)
t = LongTable(data)
t.setStyle(TableStyle([('INNERGRID', (0,0), (-1, -1), 0.25, colors.black),
('BOX', (0, 0), (-1, -1), 0.25, colors.black),
]))
elements.append(t)
doc.build(elements)
I think the best option for a PDF print might be to actually declare a pagesize large enough to handle the data. For instance if each block of the grid is 1x1 inch and one inch padding on each side, then try doing something like:
doc = SimpleDocTemplate(output, pagesize=(502*inch, 502*inch) )