[reportlab-users] confused about printing a multipage table.

matt wilbert matt.wilbert at gmail.com
Wed Mar 30 22:50:54 EST 2005


Hello all,

I am trying to generate a PDF that is one fairly big table printed on
letter-size paper in landscape orientation. I've tried a couple of
different ways, but neither works as I would expect.
.
I have two problems with my SImpleDocTemplate approach.  First, I
cannot get my table to split. If it prints on one page, fine.  If not
I get an infinite loop.

The SimpleDocTemplate code looks like:

t = Table(tabledata,columnwidths,rowheights)
doc = SimpleDocTemplate('test.pdf')
doc.build([t])

If I change it to make each row a separate table in a list of tables,
then it works.  That seems like an odd way to do it, and I don't know
if it has other negative consequences, but it doesn't seem that bad. 
However, I don't know how to change SImpleDocTemplate so that the
output is in landscape mode, which is what I want.  So if someone
knows how that can be done, that would be good.

I can generate the pdf file using a Canvas and Frames, but again if
the table is bigger than a page, I have to break the table up into
rows in order to get it to work.

If I try frame.addFromList with a large table, it doesn't seem to
throw an exception and the page comes out blank.

If I try frame.split with the same table it returns an empty list and
the page comes out blank.

What might I be doing wrong, or am I just completely misunderstanding
the documentation?

Thanks

Matt Wilbert


More information about the reportlab-users mailing list