[Tutor] A Newbie Printing Question
John Fouhy
jfouhy at paradise.net.nz
Tue Mar 29 21:22:11 CEST 2005
Richard Lyons wrote:
> I have little experience with programming. I have Python installed on a
> Windows XP system. What code do I need to use to send output from a
> Python script to a local printer attached to my workstation? to a
> network printer?
The win32print module (in Matt Hammond's windows modules) may help.
eg:
pid = win32print.OpenPrinter(win32print.GetDefaultPrinter())
win32print.StartDocPrinter(pid, 1, ('My print job', None, 'raw'))
win32print.WritePrinter(pid, s)
win32print.EndDocPrinter(pid)
win32print.ClosePrinter(pid)
When I did this, I was printing to a postscript printer, and I wasn't
printing anything that required complex layout. So I generated the
postscript code myself, and then just sent it straight to the printer...
--
John.
More information about the Tutor
mailing list