[reportlab-users] split string by width.

Juan Efren Castillo juanefren at gmail.com
Fri Nov 5 19:46:17 EDT 2010


It worked very fine, thank you very much.

On Fri, Nov 5, 2010 at 12:23 PM, Juan Efren Castillo
<juanefren at gmail.com> wrote:

> I need to print a single long string.

>

> reportlab.lib.utils.SimpleSplit works splitting by blank spaces, but

> this string has no spaces

>

> My solution was to divide string into "chunks"

>

> y  = 0

> for t in chunks(r, MAXCHARS):

>    p.drawString(d.x, page_size[1] - d.y + y, t)

>    y -= p._leading

>

>

> How ever I don't like this solution because MAXCHARS is always

> different depending on Font and Size of the text.

>

> Any ideas how to calculate MAXCHARS ? or another solution to this?

>

> Thanks in advance.

>

> --

> Juan Efrén Castillo Encinas

>




--
Juan Efrén Castillo Encinas


More information about the reportlab-users mailing list