[reportlab-users] http://two.pairlist.net/pipermail/reportlab-users/2004-April/002885.html

snodohome at web.de snodohome at web.de
Thu Sep 7 03:46:35 EDT 2006


reply on http://two.pairlist.net/pipermail/reportlab-users/2004-April/002885.html

i have the same problem.
i miss a breakline-feature in the Paragraph object.
now i found this XPreformatted object. i was happy to have my problem solved. but now there is the next one:

i create a XPreformatted object,
wrap it, but it isn't really wrapped .. is there a bug ? anyone else got this problem?

i'm using python 2.4 with reportlab 1.21

sample code which reproduces my problem
output of this programm is 'x after wrap: 23.10cm - should be less than 5cm' on my machine:

from reportlab.pdfgen.canvas import Canvas
from reportlab.platypus import XPreformatted
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import cm

c = Canvas("paraTest.pdf")


text = "this is a test text.. it should be wrapped.. this is a test text.. it should be wrapped.. this is a test text.. it should be wrapped.. this is a test text.. it should be wrapped...."
style = getSampleStyleSheet()["Normal"]

para = XPreformatted(text, style)
x, y = para.wrap(5*cm, 10*cm)

# my debug output to see that the wrap didn't do anything
# maximum available x was set to 5cm so this x should be less than 5cm
print "x after wrap: %.2fcm - should be less than 5cm" % (x / cm)

para.drawOn(c, 1*cm, 18*cm)

c.save()
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066



More information about the reportlab-users mailing list