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.py thon
Regards
-Hari 2 4456
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.py thon
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("L PT1", "wb")
printer.write(i nt('01b', 16), int('40', 16)
printer.close()
-Larry
En Wed, 05 Dec 2007 10:19:51 -0300, hari <ha********@gma il.comescribiï¿ ½:
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.
a) how to control the printer port:
You should look for some info on the protocol and timings. I vaguely
remember that you should write the desired data onto the eight data lines,
then set the STROBE control signal for some time, then reset the signal.
Something like this:
import parallel
port = parallel.Parall el()
def send_to_printer (bytes):
for byte in bytes:
port.setData(or d(byte))
port.setDataStr obe(1)
sleep(...)
port.setDataStr obe(0)
sleep(...)
send_to_printer ("Hello world\r\n")
You'll have to look for the right values to sleep in each case. Those 1/0
may be reversed too.
b) how to convert hex data:
The easiest way would be: send_to_printer ("\x1B\x40")
If you have the string "1B 40" already built:
def hex_to_raw(hex) :
return ''.join([chr(int(num,16) ) for num in hex.split()])
data = "1B 40"
send_to_printer (hex_to_raw(dat a))
--
Gabriel Genellina This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chuck Rittersdorf |
last post by:
Hi There
I am having a problem using the win32 API from VB6.
I am trying to send a command string to a printer(zebra TLP 2742) on
LPT1
using the folowing API functions
CreateFile and WriteFile
I have written C code which works fine, just the VB translation/port
|
by: David |
last post by:
I'm wondering if python is capable of fairly precise timing and also sending
data out the parallel port.
For example ; making a 7.5 KHz square wave come out of one of the data pins
on the printer port.
I've tried to help myself with this one but searching in the "Python Library
Reference" that installed with my version, yielded
nothing on the subject of either timing or parallel port.
|
by: Vlki |
last post by:
Hello,
I can't find a way to send printer specific language codes to printer.
Part of my code :
String sString = "B50,0,0,3,1,2,50,B," + "12345678901234567890";
Font fFont = new Font("Arial", 16);
SolidBrush bBrush = new SolidBrush(Color.Black);
PointF pPoint = new PointF(150.0F, 150.0F);
ev.Graphics.DrawString(sString, fFont, bBrush, pPoint);
|
by: Carlos Pezzotta |
last post by:
Hi guys,
I have to develop an application to capture the "printed"
data from another machine.
I have a specialized hardware (not a computer) that has
only a parallel port (Centronics-SPP) connected to a
printer. I think the only way to capture the information
that the system send to printer is connecting a computer
to this parallel port and pretend to be a printer. So, the
|
by: notregister |
last post by:
Hi i have a printer that is connected to my PC using a t100base lan cable
instead of the usual usb or parallel port cable. how do i send a printjob
directly to the printer using VB.Net??
| |
by: notregister |
last post by:
Hi, i have trying to send a PCL file to a printer using the following codes,
but the printer would normally hang for a long time after i have send the
command, and i do not know what wrong with it, this are ample code i found in
msdn, and yet it could not work, pls advise
Thanks
Public Function PrintChunkParallel(ByVal lPort As Long, ByVal Chunk As
String) As Long
'currently only for LPT1 only
|
by: david.brown.0 |
last post by:
I'm trying to make a Java program access a parallel port. Java's comm
API does not provide me with the control I need. I need to be able to
write to the data and control pins and read the status pins. Any Java
people know a good solution? I'm trying to use JNI and create my own
library, but building the library gives me these errors:
ld: warning: cannot find entry symbol _start; defaulting to
0000000008048094
ParallelPort.o: In...
|
by: Hector M Banda |
last post by:
Hi all,
How can I send chr(7) thru VB2005 using the parallel port?
BTW This is for a POS system.
Thanks,
-hb
|
by: deric |
last post by:
Hi! I'm new to VB.net programming on printing a page to a thermal printer (Epson T88IV). I really had a hard time figuring out how to code the printing of a bitmap image and some text, while sending commands (through font control) to the printer.
I tried sending the escape characters with Control font, but the Graphics.DrawString of PrintPageEventArgs do not allow it.. so I used the RawPrinterHelper class I found on Microsoft KB. It worked out...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |