[reportlab-users] using setWordSpacing for textobject

Przemysław Kukulski przemyslaw.kukulski at gmail.com
Tue Jul 22 14:55:28 EDT 2008


Hello everyone!

I'm creating simple documents (many documents from the same template with
user data) that contains some bold text inside which i want to justify.
Since i know always where bold text is i've figured out something like that:



i.e. Person <b>Dimmur</b> blablabla

c = canvas.Canvas("some_file.pdf")

c.setFont('Comic', 10)
obj = textobject.PDFTextObject(c)
obj.setWordSpace(0)
obj.setTextOrigin(margin_left, PAGE_HEIGHT - position)
obj.setFont('Comic', 10)
obj.textOut('Person ')
obj.setFont('Comic-Bold', 10)
obj.textOut(' %s' % name)
obj.setFont('Comic', 10)
obj.textOut(' blablabla')
x= obj.getX()

s = (PAGE_WIDTH - margin_right - x)/ 8

but i cannot set wordspacing on this textobject - from what i found i can do
it as in line 2 to get it work for all line.

Is there any simplier way to create normal document where block of text
contains bolder/italic text that is justified to some margins?

Thanks for answers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20080722/d86f42fa/attachment.html>


More information about the reportlab-users mailing list