![](/img/trans.png)
[英]Brother QL printer SDK - do not print, nothing happens (QL-710W)
[英]How to write and send a command to Brother QL serie label printer?
我現在正在嘗試用 C# 編寫一個簡單的程序,該程序將命令發送到打印機以打印純文本,但不知道如何操作。 我現在面臨的主要問題有兩個:
1、如何與打印機通訊?
在做了一些谷歌搜索但沒有得到滿意的結果后,我去了 Brothers 的主頁,在那里找到了一個所謂的 b-PAC3 SDK。
b-PAC* 軟件開發套件是一種適用於 Microsoft® Windows® 的軟件工具,允許從您自己的應用程序中打印自定義標簽。
下載並安裝后,在它安裝的目錄中,我找到了一個名為“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 的網站上搜索后,我找到了一個參考:
Brother QL 系列命令參考 (QL-500/550/560/570/580N/650TD/700/1050/1060N)
我自己沒有使用熱敏打印機的經驗,不幸的是,此命令參考中沒有任何示例,這讓我很難弄清楚應該如何編寫命令。
有人用過 Brother QL 系列打印機嗎?
PS:我使用的打印機是 Brother QL 560。
要與打印機通信,您需要做一些事情:
使用命令參考第 7 章中提供的信息和 libusb 附帶的示例,制作一個小程序,通過 USB 檢測並打開與打印機的通信通道。
然后,使用手冊中可用的其余信息,向打印機發送一系列 ESC 命令以配置它或打印標簽。
PS:如果你需要提高你在 USB 通信方面的背景,我推薦一個很好的參考,叫做“USB in a Nutshell”,可以在 Beyondlogic dot org 上找到(我不能發布兩個以上的鏈接)。
我認為OPOS(來自 Microsoft)應該是您案例的解決方案之一,由 Brother QL 560 提供,提供自己的 opos 驅動程序。 一旦您獲得驅動程序(在 dll 中),您就可以像使用一般的 Web 控件一樣輕松地開始開發。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.