Placing graphics & text on printed page - jan06call.jpg (0/1)

Paul Boddie paul at
Fri Jan 13 02:18:16 CET 2006

Steve Holden wrote:
> Michael Galvin wrote:
> > To see an example of what I am trying to accomplish, look at this page
> > on my personal website:
> >
> >
> >
> > I now realize my attachement could not be posted on this usenet group.
> >
> I suspect your best option would be to use ReportLab's open source
> package ( to generate PDF files.

One alternative, although I'm not convinced that it is actively
maintained any more, is the Piddle/Sping library [1]. As mentioned
elsewhere, the Cairo bindings would provide a similar developer
experience to that, and Cairo is increasingly fashionable.

> You may, however, be able to get at the Windows device context through
> wxPython ( if you download the demonstration you'll
> see that on Windows they do send fairly arbitrary graphics to the
> Windows printer queue.

PyQt [2] seems to support printing fairly conveniently. Consider this
very simple example:

from qt import *
import sys
qapp = QApplication(sys.argv)
printer = QPrinter(QPrinter.PrinterResolution)
painter = QPainter(printer)
painter.drawText(painter.window(), painter.AlignCenter, "Hello")

I haven't used printing in Qt [3] before, so apologies must go out if
I've made fundamental mistakes in the above code which did, admittedly,
produce output that resembled my expectations. Another route might be
to use a Tkinter canvas - at least in times of old, such canvases were
able to dump their contents as PostScript.



More information about the Python-list mailing list