[reportlab-users] flowables.KeepTogether.split() adding unnecessary FrameBreak
Robin Becker
robin at reportlab.com
Mon Feb 22 07:54:53 EST 2010
I think what's happening here is that the keepWithNext is creating a combined
flowable which is larger than the entire page or frame in height ie
KeepTogether([heading,Table([....])]). Effectively that forces the frame add to
cause an attempt to split on the next page. Unfortunately I don't think our
current methodology has enough information to make a decent decision. A better
way to keep a heading with another flowable is to use some kind of conditional
page throw
On 21/02/2010 07:30, Patrick Maupin wrote:
> This is a simplified version of a testcase that Roberto Alsina wrote, based
> on a bug report from a rst2pdf user:
>
> from reportlab.platypus import SimpleDocTemplate, Paragraph, Table
> from reportlab.lib.styles import getSampleStyleSheet
>
> ps = getSampleStyleSheet()['Normal']
> heading = Paragraph('A heading at the beginning of the document', ps)
> heading.keepWithNext=True
> paralist = [[Paragraph('This is the content', ps)] for x in range(120)]
> SimpleDocTemplate("issue277.pdf").build([heading, Table(paralist)])
>
> In RL 2.4, this prints a blank page first, unless heading.keepWithNext is
> set to False.
>
> I looked at where this is happening, but I have zero confidence that I could
> submit a patch that would not break something else, and only slightly
> greater confidence that if this is not a reportlab bug, I could figure out
> how to fix this code :-)
>
> Thanks and best regards,
> Patrick Maupin
..........
--
Robin Becker
More information about the reportlab-users
mailing list