[Tutor] Default printer in Windows

alan.gauld@bt.com alan.gauld@bt.com
Tue, 8 Oct 2002 10:47:35 +0100


> I'm trying to automate printing pdf files from zope.  I'm planning on
> converting them to postscript and then copying them right to the
> printer.  But I need the user's default printer.  Can it be 
> retrieved by python? 

What platform?

If it's Unix then it might be defined in the PRINTER environment 
variable - although this is far from universal.

If it's Windoze then just printing to the PRN or LPT ports 
should work provided the printer is a real postscript printer
(if the postscvript processing is done in a device driver 
the raw data approach may not work!).

There are also things you can do with the registry but thats 
starting to get into using the WSH COM object model or Win32API 
which may lead to its own problems within a Zope architecture.

BTW which printer are you printing on? The client browser end 
or the Zope server end? It makes a big difference! The above 
all assumes the server end, if its the client things just got 
a whole heap more complex!

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld