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); }
public override void DoPrint(string[] lines) { var q = PrinterInfo.GetPrinter(Printer.ShareName); var text = new FormattedDocument(lines, Printer.CharsPerLine).GetFormattedText(); var customPrinter = _printerService.GetCustomPrinter(Printer.CustomPrinterName); customPrinter.Process(Printer, text); }
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(); }
public override void DoPrint(string[] lines) { var q = PrinterInfo.GetPrinter(Printer.ShareName); var text = new FormattedDocument(lines, Printer.CharsPerLine).GetFormattedText(); var run = new Run(text) {Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255))}; PrintFlowDocument(q, new FlowDocument(new Paragraph(run))); }
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().ToList(); foreach (var formatter in formatters) { SendToPrinter(printer, formatter); } if (formatters.Count() > 1) printer.Cut(); printer.EndDocument(); }
public override void DoPrint(string[] lines) { Debug.Assert(!string.IsNullOrEmpty(Printer.ShareName)); var pcs = Printer.ShareName.Split('#'); var wname = "Edit"; if (pcs.Length > 1) wname = pcs[1]; var notepads = Process.GetProcessesByName(pcs[0]); if (notepads.Length == 0) notepads = Process.GetProcessesByName("notepad"); if (notepads.Length == 0) return; if (notepads[0] != null) { var child = FindWindowEx(notepads[0].MainWindowHandle, new IntPtr(0), wname, null); var text = new FormattedDocument(lines, Printer.CharsPerLine).GetFormattedText(); SendMessage(child, 0x000C, 0, text); } }
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)))); }
public override void DoPrint(string[] lines) { var text = new FormattedDocument(lines, Printer.CharsPerLine).GetFormattedText(); DoPrint(new FlowDocument(new Paragraph(new Run(text)))); }
public string GetPrintingContent(Ticket ticket, string format, int width) { var lines = _ticketFormatter.GetFormattedTicket(ticket, ticket.Orders, new PrinterTemplate { Template = format }); var result = new FormattedDocument(lines, width).GetFormattedText(); return result; }