我现在正在尝试在C#中编写一个简单的程序,它将命令发送到打印机以打印纯文本,但不知道如何。我现在面临2个主要问题,如何将命令写入并发送至Brother QL系列标签打印机?
1,如何与打印机通信?
做了一些谷歌搜索,但没有得到一个满意的结果,我去兄弟的主页时,发现有一个所谓的B-PAC3 SDK
已经下载后安装完成后,在其安装的目录中,我找到了一个名为“Samples”的文件夹 - 有一些用不同语言(VB,VS,VSC,...)编写的示例代码。我希望这些示例代码能够工作,因为这个SDK和打印机来自同一家公司。但他们没有。让我告诉你这里这些样品中的一种:(在C#代码)
/*************************************************************************
b-PAC 3.0 Component Sample (RfidRW)
(C)Copyright Brother Industries, Ltd. 2009
*************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleSampleCSharp
{
class Program
{
private const int NOERROR = 0;
private const string ANTENNA_READER_WRITER = "Reader/Writer side";
static void Main(string[] args)
{
// Create Rfid Instance
bpac.RfidClass rfid = new bpac.RfidClass(); // Rfid Instance
string selectedDevice; // selected device
/* GetInstalledDevices */
Console.WriteLine("==GetInstalledDevices()==");
object[] arrDevices = (object[])rfid.GetInstalledDevices();
if (rfid.ErrorCode == NOERROR)
{
Console.WriteLine("Succeed to GetInstalledDevices()");
int index = 0;
foreach (string device in arrDevices)
{
Console.WriteLine(String.Format("[{0}] {1}", index, device));
index++;
}
// select device
Console.WriteLine("Please Select Device");
int selectedDeviceIndex = int.Parse(Console.ReadLine());
selectedDevice = arrDevices[selectedDeviceIndex].ToString();
}
else
{
Console.WriteLine("Failed to GetInstalledDevices()");
goto CleanUp;
}
// ....
}
}
}
当我运行这段代码,第一个问题出来:(它显示出来时,在报价波纹管,对不起,我不能张贴由于图像以低信誉)
== GetInstalledDevices()==
成功到GetInstalledDevices()
请选择设备
没有任何错误,但似乎程序无法找到我的设备,我不知道为什么发生这种情况。
2,如何编写QL风格的命令?
我知道,每个类型的打印机都有自己的命令语言,所以在哥哥的网站搜索后,我发现了一个参考:
Brother QL Series Command Reference (QL-500/550/560/570/580N/ 650TD/700/1050/1060N)
我自己也与热敏打印机,不幸的是有工作没有经验在这个命令参考中没有任何示例,这使得我很难弄清楚命令应该如何写入。
以前有没有人使用Brother QL系列打印机?
P.S:我使用打印机兄弟QL 560