[plug] Python
Craig Ringer
craig at postnewspapers.com.au
Wed Jul 20 12:22:26 WST 2005
On Tue, 2005-07-19 at 13:25 +0800, David Dartnall wrote:
> Maybe a bit OT, but I'm trying to learn to program with Python in
> conjunction with Lantangen's Scripting Slides, Python Documentation and
> pydoc...
> And I can't seem to find how to redirect output to the printer...
>>> PRINTER_NAME="officehp"
>>> PRINTER_COMMAND="lp -d%s" % PRINTER_NAME
>>> import os
>>> help(os.popen)
If you need to do really funky things you can look at a PostScript
library or consider using ReportLab (which will generate PDF that CUPS
will happily print). You could even look at bindings for
libcups-client . Frankly though, for many cases just dumping plain text
to the printer is enough.
--
Craig Ringer
More information about the plug
mailing list