title: How to write and send a command to Brother QL serie label printer?
body: <p>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:</p>
  <p><em>1. How to communicate with the printer?</em></p>
  <p>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.</p>
  <p><a href="http://www.brother.com/product/dev/label/bpac/" rel="nofollow noreferrer">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.</a></p>
  <p>After having downloaded and installed it, in the directory where it's installed, I found a folder named &quot;Samples&quot;- 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#)</p>
  <pre><code>/*************************************************************************
      
      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 = &quot;Reader/Writer side&quot;;
          static void Main(string[] args)
          {
              // Create Rfid Instance
              bpac.RfidClass rfid = new bpac.RfidClass();     // Rfid Instance
              string selectedDevice;                          // selected device
  
              /* GetInstalledDevices */
  
              Console.WriteLine(&quot;==GetInstalledDevices()==&quot;);
              object[] arrDevices = (object[])rfid.GetInstalledDevices();
              if (rfid.ErrorCode == NOERROR)
              {
                  Console.WriteLine(&quot;Succeed to GetInstalledDevices()&quot;);
                  int index = 0;
                  foreach (string device in arrDevices)
                  {
                      Console.WriteLine(String.Format(&quot;[{0}] {1}&quot;, index, device));
                      index++;
                  }
  
                  // select device
                  Console.WriteLine(&quot;Please Select Device&quot;);
                  int selectedDeviceIndex = int.Parse(Console.ReadLine());
                  selectedDevice = arrDevices[selectedDeviceIndex].ToString();
              }
              else
              {
                  Console.WriteLine(&quot;Failed to GetInstalledDevices()&quot;);
                  goto CleanUp;
              }
              // .... 
          }
      }
  }
  </code></pre>
  <p>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):</p>
  <blockquote>
  <p>==GetInstalledDevices()==</p>
  <p>Succeed to GetInstalledDevices()</p>
  <p>Please Select Device</p>
  </blockquote>
  <p>There wasn't any error but seems like program can't find my device, I don't have any idea why this happens.</p>
  <p><em>2. How to write a QL-style command?</em></p>
  <p>I know that each kind of printer has its own command language so after searching on Brother's site I found a reference:</p>
  <p><a href="http://download.brother.com/welcome/docp000678/cv_qlseries_eng_raster_600.pdf" rel="nofollow noreferrer">Brother QL Series
  Command Reference
  (QL-500/550/560/570/580N/
  650TD/700/1050/1060N)</a></p>
  <p>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.</p>
  <p>Has anyone worked with Brother QL serie printers before?</p>
  <p>P.S: The printer that I'm using is Brother QL 560.</p>