title: I'm trying to send esc/pos data to a VKP80II printer in C# trough usb
body: <p>im trying to send a string data to my vkp80ii printer, i did this with a raw binary file and it printed but when i try to use string it doesn't od anything.
  Any help?</p>
  
  <pre><code>class VKP80II_Driver
  {
  
      static USBH_Printer printer;
      static AutoResetEvent printerConnected = new AutoResetEvent(false);
  
      public static void Main()
      {
          // Subscribe to USBH event.
          USBHostController.DeviceConnectedEvent += DeviceConnectedEvent;
  
          // wait for printer to be connectoed.
          printerConnected.WaitOne();
  
          // Get file to print
          //byte[] buffer = Resources.GetBytes(Resources.BinaryResources.beep);
          byte[] buffer = StrToByteArray("$0AHello World");
  
          // Printing can take a long time, give it a 5 seconds timeout here
          printer.SendData(buffer, 0, buffer.Length, 5000);
  
          // Sleep forever
          Thread.Sleep(Timeout.Infinite);
      }
  
      // Is printer connected event
      static void DeviceConnectedEvent(USBH_Device device)
      {
          if (device.TYPE == USBH_DeviceType.Printer)
          {
              printer = new USBH_Printer(device);
              printerConnected.Set();
          }
      }
  
      // Parse string object to byte array
      static byte [] StrToByteArray(string str)
      {
          System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
          return encoding.GetBytes(str);
      }
  }
  </code></pre>