ManZ
ManZ

Reputation: 21

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

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(); 

Upvotes: 1

Views: 554

Answers (1)

ManZ
ManZ

Reputation: 21

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

Upvotes: 1

Related Questions