private void PrintArray(string[] array) { NewStatusWindow(99); string textToPrint = string.Empty; foreach (string text in array) { if ((linesLeftOnCurrentPage == 0) && (!LoadNextSlipPaper(false))) { return; } textToPrint = text; if (LSRetailPosis.Settings.HardwareProfiles.Printer.BinaryConversion == true) { oposPrinter.BinaryConversion = 2; // OposBcDecimal textToPrint = Peripherals.ConvertToBCD(text + Environment.NewLine, this.characterSet); } oposPrinter.PrintNormal((int)OPOSPOSPrinterConstants.PTR_S_SLIP, textToPrint); oposPrinter.BinaryConversion = 0; // OposBcNone linesLeftOnCurrentPage--; } }
private void DisplayTextAt(int row, string textToDisplay) { if (LSRetailPosis.Settings.HardwareProfiles.LineDisplay.BinaryConversion) { oposLineDisplay.BinaryConversion = 2; // OposBcDecimal textToDisplay = Peripherals.ConvertToBCD(textToDisplay, this.characterSet); } oposLineDisplay.DisplayTextAt(row, 0, textToDisplay, (int)OPOSLineDisplayConstants.DISP_DT_NORMAL); oposLineDisplay.BinaryConversion = 0; // OposBcNone }
/// <summary> /// Print a receipt containing the text to the OPOS Printer. /// </summary> /// <param name="textToPrint"> The text to print on the receipt</param> private void OPOSPrinting(string textToPrint) { Match barCodeMarkerMatch = Regex.Match(textToPrint, barCodeRegEx, RegexOptions.Compiled | RegexOptions.IgnoreCase); bool printBarcode = false; string receiptId = string.Empty; if (barCodeMarkerMatch.Success) { printBarcode = true; // Get the receiptId receiptId = barCodeMarkerMatch.Groups[1].ToString(); // Delete the barcode marker from the printed string textToPrint = textToPrint.Remove(barCodeMarkerMatch.Index, barCodeMarkerMatch.Length); } // replace ESC with Char(27) and add a CRLF to the end textToPrint = textToPrint.Replace("ESC", ((char)27).ToString()); textToPrint = textToPrint.Replace("<L>", "\x1B|1B\x1B|bC"); if (LSRetailPosis.Settings.HardwareProfiles.Printer.BinaryConversion == true) { oposPrinter.BinaryConversion = 2; // OposBcDecimal textToPrint = Peripherals.ConvertToBCD(textToPrint + "\r\n\r\n\r\n", characterSet); } oposPrinter.PrintNormal((int)OPOSPOSPrinterConstants.PTR_S_RECEIPT, textToPrint); oposPrinter.BinaryConversion = 0; // OposBcNone // Check if we should print the receipt id as a barcode on the receipt if (printBarcode == true) { oposPrinter.PrintBarCode((int)OPOSPOSPrinterConstants.PTR_S_RECEIPT, receiptId, (int)OPOSPOSPrinterConstants.PTR_BCS_Code128, 80, 80, (int)OPOSPOSPrinterConstants.PTR_BC_CENTER, (int)OPOSPOSPrinterConstants.PTR_BC_TEXT_BELOW); oposPrinter.PrintNormal((int)OPOSPOSPrinterConstants.PTR_S_RECEIPT, "\r\n\r\n\r\n\r\n"); } oposPrinter.CutPaper(100); }