sending commands to parallel printer through python
Larry Bates
larry.bates at websafe.com
Wed Dec 5 09:41:02 EST 2007
hari wrote:
> Hi all,
> I need to automate printer command testing, prinetr supports
> parallel/
> serial/USB.How can i send the commands from python to printer.
>
> I have got pyparallel, as am new to python, no idea how to work on
> it.
> Please give some tips,The comamnd to be sent to the printer is hex
> data "1B 40".please give a example,it will be grateful.
>
>
> Thank you. postedthe same in it.comp.lang.python
>
>
> Regards
> -Hari
>
>
If the printer is connected to the computer running the program you can open the
printer in binary mode and write to it directly. If it is a networked printer
you will need to write to the spooler.
printer=open("LPT1", "wb")
printer.write(int('01b', 16), int('40', 16)
printer.close()
-Larry
More information about the Python-list
mailing list