[reportlab-users] paragraph height

Robin Becker robin at reportlab.com
Tue Nov 27 07:06:51 EST 2007


Gustavo Henrique Cervi wrote:

> great.

>

> import reportlab, reportlab.lib.styles, reportlab.lib.pagesizes,

> reportlab.platypus

> style = reportlab.lib.styles.getSampleStyleSheet()

> pdf = reportlab.platypus.SimpleDocTemplate("/dev/null", pagesize =

> reportlab.lib.pagesizes.A4)

> w = reportlab.lib.pagesizes.A4[0] - (pdf.leftMargin + pdf.rightMargin)

> p = reportlab.platypus.Paragraph("xxxxxx "*400, style["Normal"])

> p.wrap(w, w)

>


The p.wrap should specify a very large number for the second argument just in
case we change the paragraph algorithm to give up early. so

p.wrap(vailwidth, availheight) --> (required width,required height)


> result: (451.27559055118104, 372)

>


returned value is (required width, required height) so your paragraph required
at least 372 points in height. Normally the returned width is the same as the
available width which you pass in.
..........

--
Robin Becker


More information about the reportlab-users mailing list