[reportlab-users] Consuming two frames with a Paragraph

Andy Robinson andy at reportlab.com
Mon Sep 20 11:10:18 EDT 2010


On 20 September 2010 15:45, Federico Fanton <federico at panizzolo.it> wrote:

> Andy Robinson wrote:

> You are right of course, but I realize I was overzealous in trying to

> simplify my example, I'm sorry :(

>


OK, but as the old treasure maps used to say, "Here be dragons...."!

We recently added some 'conditional layout logic' flowables. You can
add things in saying "if I am still in Frame X, include X", or "If I
am on even-numbered page include Y" etc. These are not
well-documented - there is a test, but it doesn't solve a real-world
problem like yours. We added them mainly so we could write logic to
insert extra pages and make sure certain printable documents followed
correct 4-page spreads.

Look in test_platypus_programming.py, and in
reportlab/platypus/flowables.py for the DocIf class.

You pass in an expression to DocIf which may refer to
'currentFrame','currentPageTemplate','availableWidth','availableHeight'
and 'page'. So after your paragraph, you can test if you are in a
left- or right-side frame, and output FrameBreaks accordingly.

I hope this helps. If you can make up a useful example and contribute
it back we would be happy to add a test or code snippet to have some
more documentation on this feature...


- Andy


More information about the reportlab-users mailing list