[Tutor] A Newbie Printing Question

Jacob S. keridee at jayco.net
Fri Apr 1 01:22:56 CEST 2005


Cool! Does anybody know of... I guess a rather *thorough* tutorial of win32?
for the very reason that I don't know that this existed, and there may be 
other things I can use that I'm missing...

TIA,
Jacob

> 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.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list