Re: Problems generating PDFs with drawText()
Marius Flage <[email protected]>
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Message-ID | <[email protected]> |
I'm talking about Reportlab. For several versions Table() didn't work, and when I then upgraded to Ubuntu Trusty 14.04.1, then the Table() was working again, but drawText() wasn't. Downgrading to 2.7 solved both problems. - Marius Den 14.12.2014 22:14, skrev Andy Robinson: > Marius, are you talking about ReportLab 2.7/3.x, or Python 2.7/3.x? > > Either way if there is a bug here we will look into it tomorrow morning. > > - Andy Robinson > > On 14 December 2014 at 21:08, Marius Flage <[email protected]> wrote: >> Your answer did at least lead me to downgrade to 2.7 and then both >> approaches worked - both Table() and drawText(). >> >> Thanks, I guess :) >> >> - Marius >> >> Den 14.12.2014 15:43, skrev Adrian Klaver: >>> On 12/14/2014 05:17 AM, Marius Flage wrote: >>>> Hi! >>>> >>>> I wrote a small script to generate invoices from GNUCash with reportlab, >>>> but haven't been able to use it for the last couple of years. Firstly >>>> because an error with the drawOn and Table methods which outputted >>>> nothing. After an upgrade to the latest version of reportlab, then >>>> tabular data started working again and I could use these methods again, >>>> but now drawText() has stopped working. drawString() works fine, but >>>> drawText() outputs nothing in the PDF document. >>>> >>>> Here's my code: >>>> >>>> from reportlab.lib.units import mm >>>> from reportlab.lib import colors >>>> from reportlab.lib.pagesizes import A4 >>>> from reportlab.pdfgen import canvas >>>> from reportlab.platypus import * >>>> from reportlab.rl_config import defaultPageSize >>>> from reportlab.lib.styles import getSampleStyleSheet >>>> >>>> c = canvas.Canvas("test.pdf", A4) >>>> >>>> # company information >>>> text = c.beginText() >>>> text.setTextOrigin(150*mm, 282*mm) >>>> text.textLines("""test dwkmflwkmfw >>>> telkmtlwkmtw >>>> tlkmewltmwt""") >>>> c.drawText(text) >>>> >>>> c.showPage() >>>> c.save() >>>> >>>> --------- >>>> >>>> But test.pdf is empty. Any idea? I'm running the latest version of >>>> reportlab as installed from pip install reportlab. >>> No idea. I can confirm though that the above works in 2.7 but not in >>> 3.1.8 >>> >>>> - Marius >>> >>> >> _______________________________________________ >> reportlab-users mailing list >> [email protected] >> https://pairlist2.pair.net/mailman/listinfo/reportlab-users > >