POS für .Net-Druckformatierung - Escape-Zeichen (Zeichen) können nicht verwendet werden 27
Ich habe herausgefunden, wie man einfachen Text auf unserem POS-Drucker druckt, aber ich kann nicht herausfinden, wie die Escape-Zeichen funktionieren (für Fettdruck, Textausrichtung usw.). Im Moment teste ich nur mit dem Microsoft PosPrinter Simulator.
Hier ist was ich versuche
_printer.PrintNormal(PrinterStation.Receipt, (char)27 + "|bC" + printText + (char)13 + (char)10);
Ich würde davon ausgehen, dass meineprintText
in Fettdruck, gefolgt von einem Zeilenumbruch. Wenn ich rausnehme(char)27 + "|bC"
dann funktioniert es gut.
DasDokumentation für die Escape-Codes finden Sie hier
Der Fehler, den ich erhalte, ist
In Microsoft.PointOfService.ControlBase.dll trat eine erste zufällige Ausnahme vom Typ "System.FormatException" auf. Die Eingabezeichenfolge hatte kein korrektes Format.
Ich habe ein paar Variationen ausprobiert, kann mich aber nicht darum kümmern.
Bearbeiten. Hier ist der Stack-Trace.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s, IFormatProvider provider)
at Microsoft.PointOfService.DeviceSimulators.PosPrinterSimulatorWindow.ProcessEscapes(String str)
at Microsoft.PointOfService.DeviceSimulators.PosPrinterSimulatorWindow.DisplayText(String str)
at Microsoft.PointOfService.DeviceSimulators.PosPrinterSimulator.PrintNormalImpl(PrinterStation station, PrinterState printerState, String data)
at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.OutputRequestHandler(OutputRequest Request)
at Microsoft.PointOfService.Internal.PosCommonInternal.ProcessOutputRequest(OutputRequest request, Boolean asyncOperation)
at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.ProcessRequest(PrintOperation operation)
at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.PrintNormal(PrinterStation station, String data)
at MyProjectNamespace) in MyFile.cs:line 74