Text printing under Windows
ws-news at gmx.at
Thu Mar 22 16:50:04 CET 2001
I think you can just open the file 'LPT1' and write your data there, but not
sure about that - do not have a printer connected which I could use to try.
You probably need to open the device with Windows' CreateFile() API
function, provided by the win32file module in Python.
Another possibility is to dump the data to a text file and print it with
notepad.exe (it has an option /p to just print and exit...).
One more possibility is to use the ShellExecute(Ex) APIs, using 'print' as
the verb for that file (it must be a textfile (*.txt) for that to work)
"Gabriele Favalessa" <ego at macondo.visconti.home> wrote in message
news:slrn9bk130.10l.ego at macondo.visconti.home...
> how do I print using a dot matrix printer in text mode under Windows
> 98? I have both a local and a remote printer.
> I use python 2.0 and wxPython 2.2.5. The latter seems to support
> printing only in bitmap mode.
> My knowledge of win32 APIs is poor, I'm looking for a simple
> open/write/close API. Something similar to:
> printer = os.popen ("lpr -Pprinter1")
> printer.write ("Hello world!\n")
> printer.close ()
> that works fine under unix.
> Thanks in advance.
More information about the Python-list