/// <summary> /// Initializes a new instance of the <see cref="Printer" /> class. /// </summary> /// <param name="printerName">Printer name, shared name or port of printer install</param> /// <param name="type">Command set of type printer</param> /// <param name="colsNormal">Number of columns for normal mode print</param> /// <param name="colsCondensed">Number of columns for condensed mode print</param> /// <param name="colsExpanded">Number of columns for expanded mode print</param> public Printer(string printerName, PrinterType type, int colsNormal, int colsCondensed, int colsExpanded) { _printerName = string.IsNullOrEmpty(printerName) ? "temp.prn" : printerName.Trim(); _printerType = type; #region Select printer type switch (type) { case PrinterType.Epson: _command = new EscPos(); break; case PrinterType.Bematech: _command = new EscBema(); break; case PrinterType.Daruma: _command = new EscDaruma(); break; } #endregion #region Configure number columns ColsNomal = colsNormal == 0 ? _command.ColsNomal : colsNormal; ColsCondensed = colsCondensed == 0 ? _command.ColsCondensed : colsCondensed; ColsExpanded = colsExpanded == 0 ? _command.ColsExpanded : colsExpanded; #endregion }
internal PrintCommandHandler(IPrintCommand cmd, IPrinterNotifier notifier, params ISufficientLevelIndicator[] indicators) { _cmd = cmd; _n = notifier ?? new EmptyPrinterNotifier(); InjectSufficientLevelIndicators(indicators); ValidateHandler(); }
/// <summary> /// Initializes a new instance of the <see cref="Printer" /> class. /// </summary> /// <param name="printerName">Printer name, shared name or port of printer install</param> /// <param name="type">Command set of type printer</param> /// <param name="colsNormal">Number of columns for normal mode print</param> /// <param name="colsCondensed">Number of columns for condensed mode print</param> /// <param name="colsExpanded">Number of columns for expanded mode print</param> /// <param name="encoding">Custom encoding</param> /// <param name="protocol">Communication procotol</param> public Printer(string printerName, PrinterType type, int colsNormal, int colsCondensed, int colsExpanded, Encoding encoding, ProtocolType protocol) { _printerName = string.IsNullOrEmpty(printerName) ? "temp.prn" : printerName.Trim(); _printerType = type; _encoding = encoding; _command = PrinterCommandFactory(type); _engine = EngineFactory(protocol); ConfigureCols(colsNormal, colsCondensed, colsExpanded); }
public void PrintDocument() { Command = new InkPrintCommand(); Command.ExecutePrint(Document); Command = new LaserPrintCommand(); Command.ExecutePrint(Document); return; }
public Printer(string printerName, PrinterType type) { _printerName = string.IsNullOrEmpty(printerName) ? "temp.prn" : printerName.Trim(); _printerType = type; switch (type) { case PrinterType.Epson: _command = new EscPos(); break; case PrinterType.Bematech: _command = new EscBema(); break; } }
public void AddCommand(IPrintCommand printCommand) { this._PrintCommands.Add(printCommand); }
public Printer(string printerName) { _printerName = string.IsNullOrEmpty(printerName) ? "escpos.prn" : printerName.Trim(); _command = new EscPos(); }
public Printer(string printerName, string codepage = "IBM860") { _printerName = string.IsNullOrEmpty(printerName) ? "escpos.prn" : printerName.Trim(); _command = new EscPos(); _codepage = codepage; }