[reportlab-users] bugfix for reordering problem
Robin Becker
robin at reportlab.com
Thu Jan 28 05:52:53 EST 2010
On 27/01/2010 16:32, Robert Hölzl wrote:
>
> hello,
>
> since I did not find another way to contact reportlab
> (support at reportlab.com denied my mails),
> I use this forum to post the bugfix I did in the reportlab library.
> Please forward it the the development department:
>
> Under some specific circumstances the flowables of a story may be
> reordered in a wrong way.
> Please refer to "reordering_test.py" (see attachment) to reproduce the
> bug. It creates a pdf that looks like "test_error.pdf" (see attachment).
> After applying the patch "reordering_patch" to
> reportlab/platypus/doctemplate.py it works correctly (see
> test_ok.pdf).
>
> Would be glad if I get feedback if you are happy with this bugfix and if
> you will incorporate it into the next reportlab release.
........
I'm not certain I understand the problem you are encountering; if I use
KeepTogether instead of your SmartKeepTogether in your script ie
> story += [
> KeepTogether( [
> Paragraph("---- caption ---", titleStyle),
> Paragraph("text " * 1100, textStyle)
> ] ),
> KeepTogether( [
> Paragraph("----- CAPTION2 ---", titleStyle),
> Paragraph("TEXT " * 200, textStyle)
> ] ),
> ]
then the result looks like test_ok.pdf; if I use your SmartKeepTogether then the
result looks like test_error.pdf.
However, it seems you wish to achieve something else with your class. So far as
I can tell it seems to be performing as expected from its definition.
The definition of KeepTogether is fairly odd and arguably stupid. Logically we
ought to be doing the following
If the whole content can fit on the maximum available space, but cannot fit on
the current available space then issue a break + the content otherwise issue the
content. However, we have problems related to the availability of the maximum
space so this is actually quite hard to do automatically. That said I think the
existing behaviour is carried out very strangely (I probably did it as well).
--
Robin Becker
More information about the reportlab-users
mailing list