How to write and send a command to Brother QL serie label printer?
Asked Answered
B

2

8

I'm now trying to write a simple program in C# that sends command to the printer to print a plain text but don't know how to. There are 2 main problems that I'm facing now:

1. How to communicate with the printer?

After doing some google search but not getting a satisfying result I went to Brothers' main page and found there a so-called b-PAC3 SDK.

The b-PAC* Software Development Kit is a software tool for Microsoft® Windows® that allows customized labels to be printed from within your own applications.

After having downloaded and installed it, in the directory where it's installed, I found a folder named "Samples"- there are sample codes written in some different language (VB, VS, VSC, ...) I hoped that these sample codes would work since this SDK and the printer come from the same company. But they didn't. Let me show you one of these samples here: (code in 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;
            }
            // .... 
        }
    }
}

When I run this code, the first problem comes out: (it displayed exactly as in quote bellow, sorry, I can't post image due to low reputation):

==GetInstalledDevices()==

Succeed to GetInstalledDevices()

Please Select Device

There wasn't any error but seems like program can't find my device, I don't have any idea why this happens.

2. How to write a QL-style command?

I know that each kind of printer has its own command language so after searching on Brother's site I found a reference:

Brother QL Series Command Reference (QL-500/550/560/570/580N/ 650TD/700/1050/1060N)

I myself have no experience in working with thermal printer and unfortunately there isn't any sample in this command reference which makes it really difficult for me to figure out how the command should be written.

Has anyone worked with Brother QL serie printers before?

P.S: The printer that I'm using is Brother QL 560.

Behl answered 28/4, 2013 at 14:25 Comment(0)
C
1

To communicate with the printer, you need a few things:

  1. Get a USB library, like libusb (http://libusb.info/)
  2. Install a driver that will allow you to access the printer via libusb, like Zadig for example (http://zadig.akeo.ie/)
  3. Download the printer's Command Reference from the Internet ("Brother QL Series Command Reference")

Using the information provided in chapter 7 of the command reference and the samples that come with libusb, make a small routine that will detect and open a communication channel with the printer via USB.

Then, using the rest of the information available in the manual, send a series of ESC commands to the printer to either configure it or print labels.

PS: If you need to improve your background on USB communication, I recommend an excellent reference called "USB in a Nutshell", available at beyondlogic dot org (I can't post more than two links).

Cologarithm answered 8/9, 2016 at 7:15 Comment(0)
N
0

I think OPOS (from Microsoft) should be the one of the solutions for your case, provided with Brother QL 560 offering its own opos driver. Once you get the driver (in dll), you can just start developing as easily as using general web controls.

Necrophobia answered 14/9, 2014 at 17:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.