Esempio n. 1
0
 public override void DoPrint(string[] lines)
 {
     Debug.Assert(!string.IsNullOrEmpty(Printer.ShareName));
     var text = new FormattedDocument(lines, Printer.CharsPerLine).GetFormattedText();
     if (!Utility.IsValidFile(Printer.ShareName) || !SaveToFile(Printer.ShareName, text))
         SendToNotepad(Printer, text);
 }
Esempio n. 2
0
 public override void DoPrint(string[] lines)
 {
     var document = new FormattedDocument(lines, Printer.CharsPerLine).GetFormattedDocument().ToArray();
     foreach (var line in document)
     {
         var data = line.Contains("<") ? line.Split('<').Where(x => !string.IsNullOrEmpty(x)).Select(x => '<' + x) : line.Split('#');
         foreach (var s in data)
         {
             if (s.Trim().ToLower() == "<w>")
                 System.Threading.Thread.Sleep(100);
             if (s.ToLower().StartsWith("<lb"))
             {
                 SerialPortService.WritePort(Printer.ShareName, RemoveTag(s) + "\n\r");
             }
             else if (s.ToLower().StartsWith("<xct"))
             {
                 var lineData = s.ToLower().Replace("<xct", "").Trim(new[] { ' ', '<', '>' });
                 SerialPortService.WriteCommand(Printer.ShareName, lineData, Printer.CodePage);
             }
             //else SerialPortService.WritePort(Printer.ShareName, RemoveTag(s), Printer.CodePage);
             else SerialPortService.WritePort(Printer.ShareName, RemoveTag(s));
         }
     }
     SerialPortService.ResetCache();
 }
Esempio n. 3
0
        public override void DoPrint(string[] lines)
        {
            var printer = new LinePrinter(Printer.ShareName, Printer.CharsPerLine, Printer.CodePage);
            printer.StartDocument();

            var formatters = new FormattedDocument(lines, Printer.CharsPerLine).GetFormatters();
            foreach (var formatter in formatters)
            {
                SendToPrinter(printer, formatter);
            }

            printer.Cut();
            printer.EndDocument();
        }
Esempio n. 4
0
 public override void DoPrint(string[] lines)
 {
     var q = PrinterInfo.GetPrinter(Printer.ShareName);
     var text = new FormattedDocument(lines, Printer.CharsPerLine).GetFormattedText();
     PrintFlowDocument(q, new FlowDocument(new Paragraph(new Run(text))));
 }
Esempio n. 5
0
 public override void DoPrint(string[] lines)
 {
     var text = new FormattedDocument(lines, Printer.CharsPerLine).GetFormattedText();
     DoPrint(new FlowDocument(new Paragraph(new Run(text))));
 }