[reportlab-users] Flowable too large (bug in doctemplate.py)

Denis S. Otkidach reportlab-users@reportlab.com
Thu Nov 4 08:16:22 EST 2004


The following code fails with "LayoutError: Flowable <Paragraph at
...>test test test test test test  too large on page 2":

-->8--
from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame,
Paragraph
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.pagesizes import A4

doc = BaseDocTemplate('test_flowables.pdf')
pt = PageTemplate(
        frames=[Frame(x1=10, y1=10, width=A4[0]-20, height=A4[1]-20)],
        id='normal')
doc.addPageTemplates(pt)
doc.build([Paragraph('test '*200, ParagraphStyle('normal'))]*50)
-->8--

I've discovered that attribute _postponed is set to avoid infinite loops
with comment "this ought to be cleared when they are finally drawn!",
but it's realy is cleared only when the whole story is passed. 
Certainly, I can change the last line to "doc.build([Paragraph('test
'*200, ParagraphStyle('normal')) for i in range(50)])" to work around
this bug, but reusing of some flowable elements is quite common. 

I know I can wrap all reused flowables so that this attribute is set to
unique wrapper instance and not shared flowable itself, but this would
be annoying.  Any other ideas how to quick-fix it?

-- 
Denis S. Otkidach
http://www.python.ru/      [ru]



More information about the reportlab-users mailing list