Print string to a printer  
Author Message
koosha





PostPosted: .NET Base Class Library, Print string to a printer Top

I developed an application that works with a thermal printer .For opening cash drawer I need to send a control character to printer.I tried to send my character by printdocument object but it seems this object change my text to grafic that I don't want.So what can I do


.NET Development19  
 
 
Xtremer





PostPosted: .NET Base Class Library, Print string to a printer Top

Hoping your printer using COM1 or LPT1, just open the port and write the bytes. Have a look at the following namespace:

System.IO.Ports

.............................

Me.m_com = My.Computer.Ports.OpenSerialPort(Me.m_portName, Me.m_baudRate, Me.m_parity, Me.m_dataBits, Me.m_stopBits)
Me.m_com.Write("Your String")

...................................

Good luck,

/Xtremer


 
 
koosha





PostPosted: .NET Base Class Library, Print string to a printer Top

hi
there is no any lpt port in computer.ports.What should I do by the way, I don't want care how printer connected to computer.I want to send to a specify printer by printer name


 
 
nobugz





PostPosted: .NET Base Class Library, Print string to a printer Top

Several threads on these forums talk about this, check out the results of this query.


 
 
koosha





PostPosted: .NET Base Class Library, Print string to a printer Top

hi
I want to send a line like followed for my printer:
print "a" , font("FontControl",8.5)

How should I do that