title: QR Code byte data
body: <p>I have a QR Code sample from a manufacturer for a mobile printer (below). What I need to know is how to generate a new QR Code in the same format? How do I create a QR Code in this format (actually I would prefer a byte array). </p>
  
  <p>What confuses me is the hex data, it is not square nor does is seem to represent "ons" and "offs" as I would expect a QR code to do. I have tried using Zxing:</p>
  
  <pre><code>public byte[] CreateQRCode()
  {
      Charset charset = Charset.forName("UTF-8");
      CharsetEncoder encoder = charset.newEncoder();
      byte[] b = null;
      try {
          // Convert a string to UTF-8 bytes in a ByteBuffer
          ByteBuffer bbuf = encoder.encode(CharBuffer.wrap("utf 8 characters - i used hebrew, but you should write some of your own language characters"));
          b = bbuf.array();
      } catch (CharacterCodingException e) {
          System.out.println(e.getMessage());
      }
  
      String data;
      try {
          data = new String(b, "UTF-8");
          // get a byte matrix for the data
          BitMatrix matrix = null;
          int h = 100;
          int w = 100;
          com.google.zxing.Writer writer = new MultiFormatWriter();
          try {
              Hashtable&lt;EncodeHintType, String&gt; hints = new Hashtable&lt;EncodeHintType, String&gt;(2);
              hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
              matrix = writer.encode(data,
                      com.google.zxing.BarcodeFormat.QR_CODE, w, h, hints);
          } catch (com.google.zxing.WriterException e) {
              System.out.println(e.getMessage());
          }
          //matrix.get(x, y) returns a boolean
          //matrix.getRow(arg0, arg1) takes a BitRow as a parameter - not sure how to use that method         
      } catch (UnsupportedEncodingException e) {
          System.out.println(e.getMessage());
      }       
  }
  </code></pre>
  
  <p>What is confusing about the zxing code is that it takes width and height as a parameter... did they only write this library for it to produce images?<br/><br/>
  Hex QR Code:<br/>
  1B 4B 2E 00 00 00 3F 3F 30 30 33 33 33 33 33 33 30 30 3F 3F 00 00 00 00 0C 0C 0F 0F 30 30 03 03 00 00 3F 3F 30 30 33 33 33 33 33 33 30 30 3F 3F 00 00 0D 1B 4B 2E 00 00 00 FF FF 03 03 F3 F3 F3 F3 F3 F3 03 03 FF FF 00 00 CF CF FC FC 3F 3F 0C 0C CF CF 00 00 FF FF 03 03 F3 F3 F3 F3 F3 F3 03 03 FF FF 00 00 0D 1B 4B 2E 00 00 00 0F 0F 3C 3C 3C 3C 0C 0C 00 00 0F 0F 33 33 00 00 CC CC FC FC CF CF 3C 3C 00 00 0F 0F 3C 3C 3F 3F 03 03 33 33 00 00 0C 0C 0F 0F 00 00 0D 1B 4B 2E 00 00 00 C3 C3 F3 F3 33 33 33 33 C3 C3 03 03 33 33 F0 F0 0C 0C FC FC 03 03 CC CC FF FF F0 F0 F3 F3 F0 F0 30 30 FC FC 0C 0C 3C 3C 3F 3F 00 00 0D 1B 4B 2E 00 00 00 FF FF 00 00 3F 3F 3F 3F 3F 3F 00 00 FF FF 00 00 03 03 F0 F0 3C 3C FF FF F3 F3 0F 0F 3C 3C 03 03 C3 C3 CF CF 00 00 C3 C3 33 33 00 00 0D 1B 4B 2E 00 00 00 F0 F0 30 30 30 30 30 30 30 30 30 30 F0 F0 00 00 C0 C0 C0 C0 C0 C0 F0 F0 30 30 F0 F0 F0 F0 F0 F0 30 30 F0 F0 00 00 00 00 30 30 00 00 0D</p>
  
  <p><br/>Image:<br/>
  <img src="https://i.stack.imgur.com/NomV3.png" alt="enter image description here"></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is the documentation:<br/>
  3.24 ESC K Nl Nh d1 d2….dK<br/>
  [Name] select bitmap print mode 1<br/>
  [Format] ASCII ESC K nL nH d1….dK<br/>
  Hex 1B 4B nL nH d1….dK<br/>
  Decimal 27 75 nL nH d1….dK<br/>
  [Range]<br/>
  0 ≤ nL ≤ 255<br/>
  0 ≤ nH ≤ 1<br/>
  0 ≤ d ≤ 255<br/>
  [Description] the maximum height of this command is 8 dots, and maximum width is in printable zone;<br/>
  nL nH is low bit and high bit of the no-character bitmap, it represent the dots in the bitmap.<br/>
  [Note]<br/>
  • This command is under controlled by the command of amplify character;<br/>
  When printers adapt reverse print command, This bitmap will be printed from bottom to top.<br/></p>
  
  <pre><code>[Program example ]
  Unsigned char Str[30];
  Unsigned char i=0;
  Str[i++] = 0x1B;
  Str[i++] = 0x4B;
  Str[i++] = 15; print 15-dot wide bitmap;
  Str[i++] = 0x7C; Str[i++] = 0x44; Str[i++] = 0x44; Str[i++] = 0xFF;
  Str[i++] = 0x44; Str[i++] = 0x44; Str[i++] = 0x7C; Str[i++] = 0x00;
  Str[i++] = 0x41; Str[i++] = 0x62; Str[i++] = 0x54; Str[i++] = 0XC8;
  Str[i++] = 0x54; Str[i++] = 0x62; Str[i++] = 0x41; Str[i++] = 0x0D;
  SendDataToPrinter(Str,i); send bitmap command;
  </code></pre>