Printing from python on Windows platform

Mark Hammond MHammond at skippinet.com.au
Wed Aug 4 20:03:35 EDT 1999


I mailed a followup to this, but I should have posted it here...

Turns out that you can use Python open() on a printer device - you just need
to know the device name.  I cant test, but I believe "lpt1" will work, so
long as you have a printer connected to "lpt1".  It appears the concept of
"prn" did not make it through.

Either way, what I can test is that you can specify the name of the printer
as a network resource.  Eg:

open("\\\\boots\\officejet", "w")

will allow me to open my printer and write to it.

If you combine this with the registry functions, you could determine the
network name of the users local printer (even if on the local machine) and
open it directly.

Mark.






More information about the Python-list mailing list