c# print to matrix printer via serial port (bluetooth adapter)

511 Views Asked by At

I need to write a code to print anything in c# and wince mobile (or desktop app) to matrix printer via serial port (bluetooth adapter). I connect printer (epson lx) to my pc via bluetooth to COM5, 9600 bps, ... and trying to print with folowing code, and it work (print) something else.

Somebody help me with code for printing 'Hello World'?

My test code:

using System.IO.Ports;

using System.Runtime.InteropServices;

using System.IO;

SerialPort ComPort = new SerialPort();

ComPort.PortName = "COM5";

ComPort.Open();

ComPort.Write("Hello World");

ComPort.Close(); 
1

There are 1 best solutions below

0
On

I set printer baud rate to 9600 (default is 19200) and my initially test code work fine. It works with/without Ascii encoding.