[reportlab-users] Printing Variable Length String

Rich Shepard rshepard at appl-ecosys.com
Sat Nov 3 13:33:24 EDT 2007


Most of the canvas and textobject methods work with a single line string
of reasonably short length. textobjects.textLines() does print muliline
strings, but I'm uncertain how to accomplish that transformation.

Here's the situation. For the cover page of the model report I retrieve 8
strings from a one-line database table. One of these strings is the project
description, and it can be of any length. What I'm trying to do is print the
field names and values on the page something like this:

Field 1: Contents
Field 2: Contents ....
.............
...........
Field 3: Contents

etc. Field 2 is the one of variable length.

I can use the canvas' stringWidth() method to find the length of the Field
2 string, but I've not identified a Python or ReportLab function to wrap
that string to multiple lines and allow me to identify the new Y coordinate
for the next line.

What options do I have available? Would this one page be best printed as a
table in a platypus story?

Rich

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerators(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863


More information about the reportlab-users mailing list