[reportlab-users] Printed length of text?

Andy Robinson andy at reportlab.com
Wed Mar 28 04:00:50 EDT 2007


Robert Norman wrote:

> I just got Reportlab and love it!

>

> First is there a search able archive so that common answers can be found?


This mailing list is archived in lots of places; gmane.org is better for
searching
than the main mailing list, and google does a good job...
.


> Otherwise how do you determine the length of a string --not the number

> of characers but the space taken on the page. Other libs have such a

> function but I could not locate it?


the canvas class has a stringWidth(text, fontName, fontSize) method.

See the examples e.g. reportlab\test\test_pdfgen_general.py, and the PDf
it generates when you execute it. This has text metrics examples on the
first page.


More information about the reportlab-users mailing list