PrintDialog printDia = new PrintDialog();
printDia.PrinterSettings = new PrinterSettings();
DialogResult result = printDia.ShowDialog();
StringBuilder sb = new StringBuilder();
sb.AppendLine("<STX><ESC>A");
sb.AppendLine("<ESC>H0001<ESC>V0001<ESC>XM45676567");
sb.AppendLine("<ESC>Q1");
sb.AppendLine("<ESC>Z<ETX>");
String output = sb.ToString().Replace("<ESC>", ((char)27).ToString());
output.Replace("<STX>",((char)2).ToString());
output.Replace("<ETX>", ((char)3).ToString());
if (result == DialogResult.OK)
{ RawPrinterHelper.SendStringToPrinter(printDia.PrinterSettings.PrinterName, output); }