<div dir="ltr"><div>Good question. The text was read in from a file and was several lines long. I suspect that the process was failing to parse correctly and was seeing each character as a single line but I never found what it was splitting on or how to adjust it. I found a solution by using a multi-line version of the textobject.textLines(text, trim=0) [the trim=0 keeps spacing around the text block intact for asciiart] and placing the entire string at once instead of iterating over each line. Used the same text variable as earlier and it all did as expected.<br>
<br></div>To see it all in action, sign up for Phreaknic in a few weeks and the PDF you get in email is the output :-)<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 27, 2014 at 3:06 PM, Michael Solberg <span dir="ltr"><<a href="mailto:msolberg@redhat.com" target="_blank">msolberg@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 08/26/2014 10:37 AM, jkinney wrote:<br>
> -----BEGIN PGP SIGNED MESSAGE-----<br>
> Hash: SHA1<br>
><br>
> I'm trying to generate a 1-page pdf that has some text and a single<br>
> image (a qrcode) and I'm hitting issues. The docs for reportlab are a<br>
> better than many but still missing key details. The following will<br>
> generate the page, the text starts at the correct location, BUT the<br>
> text runs vertical down the page. I have found nothing that indicates<br>
> how to do that or fix it. By vertical down the page I mean:<br>
> l<br>
> i<br>
> k<br>
> e<br>
><br>
> t<br>
> h<br>
> i<br>
> s<br>
><br>
> grr! That _really_ messes up ascii art!<br>
><br>
> # generate the pdf file from the template, ascii art and the qrcode.png<br>
> files<br>
> # requires python-reportlab<br>
> def gen_pdf(text, asciiblock):<br>
><br>
> from reportlab.pdfgen import canvas<br>
> from reportlab.lib.units import inch<br>
> def makeqrpage(canvas):<br>
><br>
> textobject = canvas.beginText()<br>
> textobject.setTextOrigin(inch, 9.5*inch)<br>
> textobject.setFont("Helvetica-Bold", 14)<br>
> for line in text:<br>
> textobject.textLine(line)<br>
<br>
</div></div>I suspect your issue isn't actually with reportlab. What is the value<br>
of "text"? Consider:<br>
<br>
>>> text = "likethis"<br>
>>> for t in text:<br>
... t<br>
...<br>
'l'<br>
<div class="">'i'<br>
'k'<br>
'e'<br>
't'<br>
'h'<br>
'i'<br>
</div>'s'<br>
<br>
Versus<br>
<br>
>>> text = ['like', 'this']<br>
>>> for l in text:<br>
... l<br>
...<br>
'like'<br>
'this'<br>
<span class="HOEnZb"><font color="#888888"><br>
Michael.<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">-- <br>James P. Kinney III<br><i><i><i><i><br></i></i></i></i>Every time you stop a school, you will have to build a jail. What you
gain at one end you lose at the other. It's like feeding a dog on his
own tail. It won't fatten the dog.<br>
- Speech 11/23/1900 Mark Twain<br><i><i><i><i><br><a href="http://heretothereideas.blogspot.com/" target="_blank">http://heretothereideas.blogspot.com/</a><br></i></i></i></i></div>
</div>