Printing a Tk canvas under windows

Gordon Airport uce at
Fri Sep 12 20:14:10 CEST 2003

I was surprised that I couldn't find enough information out there to get 
this to work. Just enough to make a mess ;-). The code below just starts 
spitting out what I guess is postscript code, seperated by line feeds 
but not carrage returns, so they run right off the page. Certainly 
nothing graphical.

printerName = win32print.GetDefaultPrinter()
printerHandle = win32print.OpenPrinter( printerName )
win32print.StartDocPrinter( printerHandle, 1, ("test", None, "raw" ) )
win32print.WritePrinter( printerHandle, canvas.postscript() )
win32print.EndDocPrinter( printerHandle )
win32print.ClosePrinter( printerHandle )

I got the same result with None instead of "raw".
The printer's an HP deskjet 930, if that helps.

More information about the Python-list mailing list