[reportlab-users] KeepTogethor Splitting Error

Andy reportlab-users@reportlab.com
Thu, 9 Sep 2004 12:53:53 -0500


Hi Everybody,

I'm using reportlab to generate a pdf of our universities announcements.  I'm 
using a SimpleDocTemplate to do this.  Each announcement is a KeepTogethor 
flowable containing a heading, 1-3 short paragraphs, and an 'hr' element 
(basically a one pixel horizontal rule).

I've had this working for awhile now, but with the most recent set of 
announcements, I'm getting the following error when running doc.build:

-----------------------------------------------------
  File "/export/Zope-2.7/Products/BethelNews/pdf_generator.py", line 204, in 
build
    doc.build(self.elements,myFirstPage,myLaterPages)
  File 
"/usr/local/lib/python2.3/site-packages/reportlab/platypus/doctemplate.py", 
line 803, in build
    BaseDocTemplate.build(self,flowables)
  File 
"/usr/local/lib/python2.3/site-packages/reportlab/platypus/doctemplate.py", 
line 633, in build
    self.handle_flowable(flowables)
  File 
"/usr/local/lib/python2.3/site-packages/reportlab/platypus/doctemplate.py", 
line 569, in handle_flowable
    raise LayoutError("Splitting error(n==%d) on page %d in\n%s" % 
(n,self.page,f.identity(30)))

Splitting error(n==4) on page 1 in
<KeepTogether at 1135642796>...
-----------------------------------------------

Doing some research into what exactly is happening, it seems that doc.build 
attempts to add the keeptogethors to the page.  Eventually, space runs out, 
and one of the keeptogethors adds a CondPageBreak with a height of -2.  When 
handle_flowable attempts to add this cond page break, it raises the above 
error.

I'm a bit lost as to why this is happening.  Any ideas?

Thanks so much!
Andy