如何发送网页剪切命令爱普生打印机 [英] How to send page cut command to Epson printer

查看:608
本文介绍了如何发送网页剪切命令爱普生打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过发送剪纸命令到打印机(爱普生TM U220带USB接口)务实裁切纸张。 我用的打印机通用/纯文字驱动程序和EPSON打印机端口,我在安装后发现 爱普生先进的打印机驱动程序。 打印机命令code是(GS V M),其中M = 0,1,48或49,我发现在设备手册。 我想知道如何通过的StringWriter发送这些命令的打印机。 我用纯文本/通用打印机,因为它比采用爱普生驱动程序要快得多。

I'm trying to cut the paper pragmatically by sending paper cut command to the printer (Epson TM U220 with USB port). I used the printer with Generic/Text Only Driver and Epson printer port which I found after installing Epson advanced printer driver. Printer command code is (GS V m), where m = 0,1,48 or 49 which I found on the device manual. I would like to know how to send these command to printer by StringWriter. I use Generic/Text Only printer because it's much faster than using Epson driver.

我真的很新的C#窗口和请人好心给我提供的code一些行来实现这一目标。我一直在网上冲浪了好几天,仍然没有找到答案。我想,我需要发送打印命令字节,但我不知道该怎么做:(

I'm really new to C# windows and please anyone kindly provide me some lines of code to achieve this. I've been surfing the web for several days and still not found the answer yet. I think I need to send printer command as byte but I don't know how to do :(

推荐答案

非常感谢汉斯。现在,我可以通过使用Microsoft RawPrinterHelper级送剪纸命令。我一直在寻找这种解决方案六天。这是我做了什么。

Thank you very much Hans. Now I can send Paper cut command by using Microsoft RawPrinterHelper class. I've been seeking this solution for six days. Here is what I've done.

string GS = Convert.ToString((char)29);
string ESC = Convert.ToString((char)27);

string COMMAND = "";
COMMAND = ESC + "@";
COMMAND += GS + "V" + (char)1;

PrintDialog pd = new PrintDialog();
pd.PrinterSettings = new PrinterSettings();
if (DialogResult.OK == pd.ShowDialog(this))
{
RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName,  COMMAND);
}

这篇关于如何发送网页剪切命令爱普生打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆