[Tutor] Printing to a windows network printer

dman dsh8290@rit.edu
Fri, 21 Sep 2001 08:17:19 -0400


On Thu, Sep 20, 2001 at 10:37:53AM +0200, Neil Beattie wrote:
| Hi,
| I am a newbie to Python and am looking for a pointer to example code for
| printing from PythonWin 2.1.1  to a network printer from nt.

This probably isn't what you are looking for, but


printer = os.popen( "enscript //<host>/<printer>" )
printer.write( "Hello World" )
printer.close()
del printer


If you install the 'enscript' program you can print to windows
printers from the commandline, which also works from python via a
pipe.  I don't know any other way to programmatically print on a
windows system ( I don't think "copy /b <foo> LPT1" really counts )
but that is because I have no interest in windows programming and
haven't had the need yet.

-D