[reportlab-users] KeepTogether not working with Spacers any more

Christoph Zwerschke cito at online.de
Wed Jul 19 21:00:33 EDT 2006

I used to initialize a vertical spacer like

s = Spacer(0, 1*inch)

This worked nicely with ReportLab 1.20, but in ReportLab 1.21 I 
experienced a problem if such spacers appear in a KeepTogether list.

I found the reason to be the following line that has been added to the 
_listWrapOn() function calculating the height of the KeepTogether list 
by summing up the heights of the individual flowables:

if w<=_FUZZ or h<=_FUZZ: continue

Here, _FUZZ is a very small value close to 0 (1e-6). This means that 
spacers like the above with a horizontal dimension of 0 are ignored in 
the calculation. I think this should be corrected.

As a work-around, I'm now initializing the spacers with a non-zero width 
(and noticed that the user's guide does it similarly):

s = Spacer(1, 1*inch)

-- Christoph

More information about the reportlab-users mailing list