I'm sending ESC/P codes (http://webpages.charter.net/dperr/links/esc_p83.htm) to an Epson LX-300 printer which is connected to the COM1 and the pc already has the correct driver installed because someone else needs it.
So i wrote this:
using System.IO.Ports;
public class EpsonPrint {
private char esc = (char)27;
private char ff = (char)12;
public static void Main (string[] args) {
new EpsonPrint();
}
public EpsonPrint() {
SerialPort port = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One);
port.Open();
port.Write(esc+"@hola mundo!"+ff);
port.Close();
}
}
and it works but only with the Epson driver pointing to another port or something else, because if i let it using COM1 the code above throws:
"The given port name does not start with COM/com or does not resolve to a valid serial port."
and for the record, this is not a "port already open" error.