[reportlab-users] paragraph height
Robin Becker
robin at reportlab.com
Tue Nov 27 05:59:29 EST 2007
Gustavo Henrique Cervi wrote:
> Hi.
>
> How can I to get the height of an paragraph (platypus)?
> If the paragraph is too short, I want to compensate increasing the
> linespacing (leading) to fill the whole page, otherwise, I can decrease
> the linespacing to fit the text into a single page.
>
> Thanks.
>
> -Gustavo
......
If you know the width at which you wish to write the paragraph, P, the wrap call
will give you a good estimate of it's height eg
w, h = P.wrap(availableWidth,100000)
where 100000 is the height we allow (I assume your paragraph would be shorter).
Given the height you may choose to adjust leading and//or fontSize to get the
required layout.
--
Robin Becker
More information about the reportlab-users
mailing list