ReportLab LongTable LayoutError: Too large on page

I am using LongTables to display the displayed data, but when the row height is greater than the page height it falls from

  File "c:\edat\19_with_edm\fiods\..\fiods\reporting\", line 1497, in build_table, canvasmaker=NumberedCanvas)

  File "C:\Python27\lib\site-packages\reportlab\platypus\", line 880, in build

  File "C:\Python27\lib\site-packages\reportlab\platypus\", line 793, in handle_flowable
    raise LayoutError(ident)

LayoutError: Flowable <LongTable@0x018DB0A8 30 rows x 20 cols> with cell(0,0) containing
'Eq\nLvl\nD'(756.0 x 967.6) too large on page 2 in frame 'edat_table_frame'(756.0 x 504.0*) of template 'edat_page_template'



source to share

1 answer

The error looks like you are trying to format a table that is out of bounds if the frame is on the same page. I've tested the code with Table and LongTable, and it will display the data on multiple pages until you try to format the first page and the second page at the same time.

Sample code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from reportlab.platypus import SimpleDocTemplate, Table, LongTable, TableStyle, BaseDocTemplate, Frame, Paragraph, NextPageTemplate, PageTemplate
from reportlab.lib.pagesizes import letter, inch
from reportlab.lib import colors

def testPdf():
    doc = BaseDocTemplate("testpdf.pdf",pagesize=letter,
                        topMargin=72,bottomMargin=18, showBoundary=True)
width, height = letter
print width 
print height

elements = []
datas = []
for x in range(1,50):

    ('INNERGRID', (0,0), (-1,-1), 0.25,,
    ('BOX', (0,0), (-1,-1), 0.25,,

frameT = Frame(doc.leftMargin, doc.bottomMargin, doc.width, doc.height, id='normal')


if __name__ == '__main__':


if you format your table and let it say:

    ('SPAN',(0,0),(0,38), #span over the frame limit
    ('INNERGRID', (0,0), (-1,-1), 0.25,,
    ('BOX', (0,0), (-1,-1), 0.25,,


Then you will face this error. I would say probably the best way is to format the table manually, but I hope there is a better solution.



All Articles