[reportlab-users] Platypus idea "splitting preferences"

Roberto Alsina ralsina at netmanagers.com.ar
Thu Jan 14 12:22:24 EST 2010


On Thursday 14 January 2010 13:55:54 Andy Robinson wrote:

> 2010/1/14 Roberto Alsina <ralsina at netmanagers.com.ar>:

> > I am thinking there are flowables that would prefer not to be split if

> > possible, for example small literal blocks (say, a code fragment), but

> > *if needed* can be split anyway (for example if they are over a page

> > long, or would leave a half-empty page if not split).

> >

> > Would reportlab be interested in this kind of functionality? I am

> > thinking of adding a property to the flowables describing this and

> > hacking the place where frames consume flowables so it's taken into

> > account.

>

> Definitely.

>

> > Any suggestions about how the property should look like, or how it should

> > be handled are welcome, since I am still pretty fuzzy on what I really

> > mean ;-)

>

> Can you give some examples of the flowables which this would apply to?


For example, a literal block of text, like source code.

* You can't apply traditional widow/orphans control because there
may well be lots of blank lines anywhere yet it is a single "block".

* Breaking in the first 10 lines (guessing here) looks awful

* It may be very long, so you can't just treat it like a table cell

So, I was thinking maybe something like this set in the flowable (property
names suck!)

not-break-head 120
not-break-tail 100

which would mean:

a) If there is less than 120 points left in the frame, don't split the
flowable and break to the next frame instead.

b) If you split and the remaining piece is less than 100 points tall, then
break a little earlier so the fragment on the next page is larger. This could
be done by re-calling split with a shorter available height.

a) is much more important than b) I think.

A flowable without these properties would just split and be handled as it
currently does.


> I am aware of table cells being a problem, because someone might put

> pages worth of content into a table cell at the moment, and we can't

> split inside one row. But I am not sure how we could do the

> splitting.


I have implemented a "table that split cells" in rst2pdf but it's a very
limited thing, used to do things like bulleted lists, which can be very
complex in restructured text.

--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)


More information about the reportlab-users mailing list