Text printing under Windows

Konrad Koller konrad.koller at worldonline.de
Fri Mar 23 10:11:57 CET 2001


On 22 Mar 2001 14:00:29 GMT, ego at macondo.visconti.home (Gabriele
Favalessa) wrote:

>Hi,
>
>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.
>
>   Gabriele
Hello Gabriele,
I am using a laser printer instead of a matrix printer, but (under
Windows 98) I do it like this:

stdout=sys.stdout
sys.stdout=open("lpt1","w")
print "what you want to print\f"
sys.stdout=stdout

Yours Konrad



More information about the Python-list mailing list