On Jun 14, 10:55 am, Tim Golden <m...@timgolden.me.uk> wrote: > On 14/06/2010 16:31, loial wrote: > > > What is the easiest way to send a text file to a networked printer > > from a python script running on windows? > > http://timgolden.me.uk/python/win32_how_do_i/print.html
Hello Tim, Thanks for posting this wonderful win32 info at your site. I have used it quite extensively in the past and would like to know if you are interested in adding a bit more to the code to this simplistic example... import win32print printer_name = win32print.GetDefaultPrinter () # # raw_data could equally be raw PCL/PS read from # some print-to-file operation # raw_data = "This is a test" hPrinter = win32print.OpenPrinter (printer_name) try: hJob = win32print.StartDocPrinter (hPrinter, 1, ("test of raw data", None, "RAW")) try: win32print.WritePrinter (hPrinter, raw_data) finally: win32print.EndDocPrinter (hPrinter) finally: win32print.ClosePrinter (hPrinter) ... It would be nice to include some code to paginate the text. Also what seems to be missing from the Python world is some info on configuring a printer programically. MSDN is not much help to anybody and really nothing more than a smorgasbord of nonsense not even web dialogs scripting can hold a candle to, but i digress... We need more than what the CommonDialog classes expose, although some info on CD's would be helpful. Would you be interested in adding some additional info to this wonderful site? And What about image acquisition? -- http://mail.python.org/mailman/listinfo/python-list