[reportlab-users] frame overflow and hypenation

Patrick Lawrence - Reportlab Lists DwWSBmrwsPYJVQkKhwNv at patsoffice.com
Thu Mar 10 01:30:22 EST 2005


Hi Robin,

> 3) determine the space required by the flowables using the frame width
as 
> available width and an infinite height. You have to give paragraphs a
width
> anyhow. This code looks like
> 
>     rh = 0
>     for f in pageStory:
>       w,h = f.wrap(width,infinity)
>       rh += h

This gets me partially there.  I also need to take into account
f.getSpaceBefore and f.getSpaceAfter.  I ended up coming up with what's
mostly done in reportlab.platypus.frames._add().  But I forgot to take
into account that there shouldn't be space before it this is the first
item on a frame.  In my case, there won't be any but I stuck that logic
in there too. :-)

> 4) if the total height is too great you can think of scaling the fonts
and 
> leading in you styles. You should be able to use linear scaling.

I created a list of styles for each of my recipe elements that shrink
more the further you are along the list.  That way I have control over
which page items shrink first to make space on the page.  It's pretty
darn neat and it seems to work pretty well. :-)

Thanks for the guidance!

Regards,

Pat
-- 
                        "Let's Roll" - Todd Beamer



More information about the reportlab-users mailing list