[reportlab-users] Float flowable to bottom of page
Andy Robinson
andy at reportlab.com
Thu Feb 4 05:16:43 EST 2010
On 3 February 2010 21:59, James Lance <james at thelances.net> wrote:
> Is there a way to make a flowable element float to the bottom of the page?
>
> I'm working on a invoice document, at the bottom of the page is a tear off segment that can be returned with payment. I can draw directly on the canvas, but I don't want to include the segment on every page, just the last.
>
> What I've done is put all the elements that make up my tear off segment into a KeepTogether flowable. I've tried messing around with putting a spacer before it what attempts to fill all remaining space with out pushing it to the next page. I can't seem to work out the correct height of the spacer, and still be flexible concerning the previous flowable content. Of course if there are enough line items or other data then naturally the tear off segment will go to the next page.
>
> So, how can I pin the tear off to the bottom of the page while still keeping it a flowable? Is that even possible?
We added some new flowables last year for 'position dependent logic'.
Look at DocIf and DocWhile in reportlab/platypus/flowables.py for the
code, and tests/test_platypus_programming.py for examples.
You could potentially 'wrap up' a spacer so that it says "While I
have more then X inches left, output an invisible chunk and move down
an inch".
Hope this helps
--
Andy
More information about the reportlab-users
mailing list