private void TestPrintRaw()
        {
            const string ESC       = "\u001B";
            string       cmds      = ESC + "@"; //Initializes the printer (ESC @)
            const string TOF       = "\u00FF";
            const string FORM_FEED = "\f";

            string s = cmds + "Print Test RAW from PrimeActs"; // device-dependent string, need a FormFeed?

            s = s + Environment.NewLine;
            s = s + "01234567890123456789012345678901234567890123456789012345678901234567890123456789";
            s = s + Environment.NewLine;
            s = s + FORM_FEED;
            RawPrinterHelper.SendStringToPrinter("EPSON FX Series 1 (80)", s);
        }
        private void RawPrintLine(string printerName, LineModel line, int pageWidth)
        {
            string outputstring = "";

            foreach (var lineItem in line.LineItems)
            {
                if (lineItem.Image == null)
                {
                    var formatString = formatAlignRawLineItem(lineItem);
                    outputstring += formatString;
                }
            }
            outputstring += Environment.NewLine;
            RawPrinterHelper.SendStringToPrinter(printerName, outputstring);
        }
        private void RawPrintDocument(object sender, PrintPageEventArgs e, PrintDocumentModel document)
        {
            int documentPageWidth = MAX_WIDTH;

            if (document.PageWidth.HasValue)
            {
                documentPageWidth = document.PageWidth.Value;                              //DC Added PageWidth to Document Value
            }
            // Initialise Printer
            var          pd          = (System.Drawing.Printing.PrintDocument)sender;
            string       printerName = pd.PrinterSettings.PrinterName;
            string       ESC         = "\u001B";
            string       cmds        = ESC + "@"; //Initializes the printer (ESC @)
            string       condensed   = ESC + "g";
            string       subscript   = ESC + "!17";
            const string FORM_FEED   = "\f";

            RawPrinterHelper.SendStringToPrinter(printerName, cmds);
            if (document.Condensed.Value == true)
            {
                RawPrinterHelper.SendStringToPrinter(printerName, condensed);
            }
            if (document.Condensed.Value == true)
            {
                RawPrinterHelper.SendStringToPrinter(printerName, FORM_FEED);
            }
            //if (document.Condensed.Value == true) RawPrinterHelper.SendStringToPrinter(printerName, subscript);

            foreach (var section in document.Sections)
            {
                foreach (var line in section.Lines)
                {
                    System.Threading.Thread.Sleep(400);
                    // prevent buffer overrun, will need to find optimum value and make configuarable
                    if (document.Condensed.Value == true)
                    {
                        RawPrinterHelper.SendStringToPrinter(printerName, condensed);     // 05/07/2016 Test
                    }
                    RawPrintLine(printerName, line, documentPageWidth);
                    // also add the page length and count lines printed

                    //var lineout = RawPrintLineToFile(line);
                }
            }
            //TestPrintRaw();
        }