[reportlab-users] black squares for every newline
dimitri pater
dimitri.pater at gmail.com
Tue Nov 21 19:17:59 EST 2006
Thanks Andy,
line.strip() was the solution
thanks again,
Dimitri
On 11/22/06, Andy Robinson <andy at reportlab.com> wrote:
>
> dimitri pater wrote:
> > Hi,
> >
> > when I do this (snippet):
> >
> > bodytext=open('sampletext.txt','r').readlines()
> >
> > for line in bodytext:
> > textobject.textLine(line)
> > c.drawText(textobject)
> >
> > I use ("Helvetica",12) as the argument for setFont
> >
> > There are black squares for every newline in the PDF. The sampletext.txt
> > file is saved as a UTF-8 file.
> >
> > I am still new to reportlab (two days now), so I could use some help ;-)
> > I did not find answers to my question on the web.
>
> Your method of parsing the file has resulted in every line having a
> newline character at the end. This is not a valid glyph in the font
> so you get a nasty blob. Try stripping the whitespace from the line
> before printing it e.g.
>
> > for line in bodytext:
> > textobject.textLine(line.strip())
> > c.drawText(textobject)
>
>
> HTH
>
> - Andy
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>
--
---
You can't have everything. Where would you put it? -- Steven Wright
---
please visit www.serpia.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20061122/9f0e1283/attachment.htm
More information about the reportlab-users
mailing list