Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
First of all , I have searched on Google but there is no sample code using c# by which printer commands can be sent.

I am trying to send commands to printer such as
ESC c 3
to Bixolon thermal printer. The command will signal paper end if paper roll in the paper is about to end. I found some VB6 code for other commands but it doesn't work on c#. I even added a Microsoft.VisualBbasic.PowerPacks.Vs.dll to the project to send
commands to printer
C#
using Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6;

Printer printer = new Printer();
printer.Print("\x1B\x63\x33");
printer.Write("\x1B\x63\x33");

printer.EndDoc();


Bixolon command manual can be found here[^]
A sample code would be very helpful. Thank you in Advance...
Posted
Comments
Mehdi Gholam 9-Sep-11 3:57am    
How is your printer connected (via USB or COM or PARALLEL)?
Praveen Kullu 9-Sep-11 4:39am    
Via COM
squid_junior 5-Feb-13 2:36am    
What if the printer is connected via USB?
For example, KX-P1121E DotMatrix Printer. I would like to send certain ESC Command through behind code.

Use the following sample :
C#
SerialPort comPort = new SerialPort("COM1",2400); // change the parameters to your printers specs.
comPort.Open();
comPort.Write("\x1B\x63\x33"); // write to your printer here
comPort.Close();


You would probably want to create a class for handling your printer from the above code to send multiple commands etc.
 
Share this answer
 
Comments
A Gopal Reddy 9-Sep-11 7:04am    
This one is helpful, thank you.
Hi, Praveen Kullu

try the following may be helpful to you.
-> Write your data in text file which you want to pring
i.e. \x1B\x63\x33 etc...
-> Create one batch file http://www.robvanderwoude.com/printfiles.php[^]

-> Run batch file http://stackoverflow.com/questions/394036/how-to-execute-a-bat-file-from-a-c-windows-form-app[^]
http://forums.asp.net/t/1444055.aspx/1[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900