如何使用 Visual C#NET 将原始数据发送到打印机
1个回答
推荐于2016-03-20 · 知道合伙人软件行家
关注
展开全部
byte[] bty_tmp = new byte[] { 29, 86, 1, 49 };//切纸
byte[] Internal = System.Text.Encoding.Default.GetBytes(((char)27).ToString() + ((char)64).ToString());//初始化打印机 System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
System.Net.Sockets.NetworkStream stream = null;
Int32 port = 9100;
//string ipPrint = ConfigurationManager.ConnectionStrings["printIP"].ConnectionString;//获取打印机名称
string ipPrint = "192.168.0.77";
client.Connect(ipPrint, port);
stream = client.GetStream();
//是闹简历否液搜支持写入咐敬
if (!stream.CanWrite)
{
b = false;
}
stream.Write(bty_tmp, 0, bty_tmp.Length);
byte[] Internal = System.Text.Encoding.Default.GetBytes(((char)27).ToString() + ((char)64).ToString());//初始化打印机 System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
System.Net.Sockets.NetworkStream stream = null;
Int32 port = 9100;
//string ipPrint = ConfigurationManager.ConnectionStrings["printIP"].ConnectionString;//获取打印机名称
string ipPrint = "192.168.0.77";
client.Connect(ipPrint, port);
stream = client.GetStream();
//是闹简历否液搜支持写入咐敬
if (!stream.CanWrite)
{
b = false;
}
stream.Write(bty_tmp, 0, bty_tmp.Length);
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询