我正在使用Microsoft.PointOfService
库来控制 Epson POS 收据打印机。我正在尝试在收据上添加徽标,但我似乎无法使该PrintMemoryBitmap(...)
功能正常工作。该PrintBitmap(...)
功能工作得很好,但对于我的应用程序,从内存中打印位图会更有效,而不是将图像保存到文件系统中。
我的代码是:
printer.PrintMemoryBitmap(PrinterStation.Receipt, logoBitmap, PosPrinter.PrinterBitmapAsIs, PosPrinter.PrinterBitmapCenter);
但是当我运行它时,我收到以下错误:
ErrorCode:
Illegal
ExtendedErrorCode:
300002
Message:
Method PrintMemoryBitmap threw an exception. Attempt was made to perform an illegal or unsupported operation with the device, or an invalid parameter value was used.
StackTrace:
at Microsoft.PointOfService.Legacy.LegacyProxy.ThrowLegacyMethodException(String methodName, Int32 ResultCode, Exception e)
at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName, Object[]& parameters, Boolean[] byRef)
at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethodAndCheckImpl(String methodName, Object[]& parameters, Boolean[] byRef)
at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethodAndCheck(String methodName, Object param1, Object param2, Object param3, Object param4, Object param5)
at Microsoft.PointOfService.Legacy.LegacyPosPrinter.PrintMemoryBitmap(PrinterStation station, Bitmap data, Int32 width, Int32 alignment)
at ReceiptLogoDemo.frmPrinterDemo.btnPrintLogo_Click(Object sender, EventArgs e) in C:\projects\receiptLogoDemo\receiptLogoDemo\frmPrinterDemo.cs:line 138
我已经检查了Illegal
错误代码的含义(这里),并且我已经确认那里列出的所有内容都不是问题。此外,考虑到该PrintBitmap(...)
功能工作得很好,这真的让我很难过。
任何想法或建议将不胜感激!