[reportlab-users] Finding if a flowable is at the top of a page.

Roberto Alsina ralsina at netmanagers.com.ar
Tue May 4 07:01:29 EDT 2010

On Tuesday 04 May 2010 07:51:15 Andy Robinson wrote:

> On 19 April 2010 22:01, Andy Robinson <andy at reportlab.com> wrote:

> > Since you've got so far we'll definitely try to help out. Robin's

> > eyes are bleeding from something else at the moment but hopefully he

> > can help out tomorrow.


> Apologies for getting WAAAY behind on this one! We had a good look at

> this, and your approach is neat, but we can't see a way to handle the

> bad cases either. There are several fundamental problems with

> footnotes:


> 1. You've got some content and some footnotes, you are near the bottom

> of the page, you can fit the last paragraph in, but you then discover

> that you can't fit its footnote. Unfortunately our system cannot

> backtrack and we cannot see a way to handle this.

Oh, but that already works :-)
You see, in rst, you have the footnote references like this [1]_ and the

.. [1] This is the footnote.

In rst2pdf the "old" handling is "take away the footnotes and stack them at
the end of the document".

Or, you could "inline" them: lay them exactly where the authour put them.

What I am trying to do is mix them up: I inline them, then I rearrange
flowables **inside the page**.

If the footnote got split, that's ok, because it would be, for all practical
purposes, two footnotes, one on each page, and the reshuffling still works.

> 2. You get a really long footnote. Most publishers split these so

> they can never use more than (say) half a page, and any continuation

> flows onto the footnotes of the next page

That works already too.

> 3. Footnote references could easily appear inside content in table

> cells, which would make it MUCH more complex to fix up the main loop;

> we can't split table rows. Even if we could fix (1) and (2) we'd

> probably have to rule that footnotes in tables and other containers

> would just get ignored.

Nope, no problem for my approach, as long as the footnote itself is outside
the table. It could be that the footnote is pushed to the next page if the
table fills the page, but that's not really horrible.

> 4. In real books, the footnotes start a bit lower down than the normal

> foot of the frame; and in two-column layouts they span the frames. So

> ideally you would have a separate 'footnotes frame' which grew up and

> shortened the ones above it. (However people can live without this

> one - your simple approach is useful for many...)

Yes, two-column layouts won't work well. Making it start lower is not a

Really, I am very close to something that works for at least some cases, if
only I could tell what flowable starts a page :-)

> > Which do you want first, this or the

> > Case-Study-submission-system fix ;-) ?


> We think we have now fixed this up so markdown can be used. Please

> have a look and also send us any extra imagery and screenshots you'd

> like...

Cool, I'll take a look at it today or tomorrow.

More information about the reportlab-users mailing list