I'm using the Microsoft.PointOfService
library to control an Epson POS receipt printer. I'm trying to add logos to the receipts, but I can't seem to get the PrintMemoryBitmap(...)
function to work. The PrintBitmap(...)
function works just fine, but for my application, it would be much more efficient to print a bitmap from memory, instead of saving the image to the file system.
My code is:
printer.PrintMemoryBitmap(PrinterStation.Receipt, logoBitmap, PosPrinter.PrinterBitmapAsIs, PosPrinter.PrinterBitmapCenter);
But when I run this, I get the following error:
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
I have checked the meaning of the Illegal
error code (here), and I have confirmed that none of the things listed there are the issue. Also, considering that the PrintBitmap(...)
function works just fine, this really has me stumped.
Any ideas or suggestions would be greatly appreciated!