0

以下は、Micrsoft.PointOfService プリンターの ESC コードです。

  string escAlignCenter = String.Format("{0}|cA", ((char)27));
  string escAlignRight = String.Format("{0}|rA", ((char)27));
  string escBoldOn = String.Format("{0}|bC", ((char)27));
  string escNewLine = String.Format("{0}|1lF", ((char)27));
  string escPaperCut = String.Format("{0}{1}|P", ((char)27), AppSettings.POSPrinterLinesToCut);
  string escReset = String.Format("{0}|N", ((char)27));
  string escUnderlineOn = String.Format("{0}|uC", ((char)27));

このコード

simulatedReceipt.AppendLine(string.Format("{0}{1}Header will appear Here{2}",  escBoldOn, escAlignCenter, escReset));

でシミュレータープリンターに送信されたとき

 textToPrint = simulatedReceipt.ToString();
 posPrinter.PrintNormal(PrinterStation.Receipt, textToPrint);

結果:

  System.FormatException occurred
  HResult=-2146233033
  Message=Input string was not in a correct format.
  Source=mscorlib
  StackTrace:
       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 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 MyCourts.PrintReceiptManager.printToPOSPrinter() in e:\MyCourts\MyCourts\Managers\PrintReceiptManager.cs:line 558
  InnerException: 

残念ながら、テストするための適切なレシート プリンターはありませんが、組み込みのサーマル プリンター シミュレーターでのみエラーが発生すると思われます。

誰でも私の疑いを確認できますか。

4

1 に答える 1

0

SDK の例を調べると、シミュレーターに送信する前に制御コードが削除されていることが明らかであるため、シミュレーターは BOLD などをシミュレートしないようです。

于 2016-05-08T00:36:16.983 に答える