c# - 如何使用 C# 通过 USB 将 EPL2 命令发送到 Zebra LP2844 打印机

标签 c# usb zebra-printers epl

我需要使用 C# 在 Zebra 标签打印机上打印标签和条形码。我以前从未使用过它们,但阅读并试图找出一种方法来做到这一点。我从 http://support.microsoft.com/kb/322091 中看到这段代码,但它没有用。从我的试验中,我可以看到我能够将数据发送到打印机,但它没有响应和打印。我正在使用按钮将命令发送到打印机,就像 kb 文章中一样。

private void  ConnectButton_Click(object sender, EventArgs e)
{
    // Allow the user to select a printer.
    string s =  "B26,26,0,UA0,2,2,152,B,\"{0}\"";
    PrintDialog pd =  new PrintDialog();
    pd.PrinterSettings = new PrinterSettings();
    if (DialogResult.OK == pd.ShowDialog(this))
    {
       // Send a printer-specific to the printer.
       RawPrintrHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName,s);
       MessageBox.Show("Data sent to printer.");
    }
}

最佳答案

以下两篇博文由Nicholas Piasecki撰写对于尝试从 .NET 打印到 Zebra 打印机的每个人来说都是宝贵的资源:

(his website 现在似乎已经死了,所以链接转到了 Wayback Machine )

我已经使用 Zebra 打印机和 EPL 超过 10 年,其中大约 6 年使用 .NET。
当我开始使用 Zebra/EPL 和 .NET 时,我只需要这两篇博文就可以让它正常工作。


关于这个:

And I have come across this code from http://support.microsoft.com/kb/322091, but it didn't work. From my trials I can see that I was able to send the data to the printer but it doesn't respond and print.

那篇文章的代码中有一个错误,解决方案在我链接的第一篇博客文章的底部有解释。

关于c# - 如何使用 C# 通过 USB 将 EPL2 命令发送到 Zebra LP2844 打印机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31892605/

相关文章:

c# - 我可以一次合并这两个列表吗

c# - 使用 iTextSharp (C#) 从 PDF 中提取嵌入式 XML

C#获取连接到PC的可移植设备

linux - Linux USB 内核驱动程序如何与 USB Wi-Fi 卡内的 EEPROM 交互?

android - Zebra 打印机无法打印 ZPL 格式

zebra-printers - 如何获取 CPF 文件到 QL420/QL220

c# - IE11切换到文档模式: IE7 Standards

c# - 在 SQL Server 中使用 sql_variant 而不是 varchar 有什么好处吗?

android - 注意 Honeycomb 或更高版本 Android 的外部 USB 存储的变化

android - 在 Zebra RW420 中,线条打印模式在 android 中不起作用