public static bool SendTestPage(string target) {
string msg = "\n" +
"################################\n" +
"\x001BE1" + //bold on
"This is a print test\n\n" +
"\x001BE0" + //bold off
DateTime.Now.ToLongTimeString() + "\n" +
DateTime.Now.ToLongDateString() + "\n" +
"################################\n" +
"\n\n\n\n\n\n\n\n" +
"\x1Bm\0\0"; //cut
Byte[] data = Encoding.ASCII.GetBytes(msg);
try {
TcpClient client = new TcpClient();
client.Connect(target, 9100);
NetworkStream stream = client.GetStream();
stream.Write(data, 0, data.Length);
stream.Flush();
stream.Close();
client.Close();
} catch {
return false;
}
return true;
}