我有一个运行在Raspbian上的应用程序,该应用程序使用RawPrinterHelper.cs
(https://github.com/andyyou/SendToPrinter/blob/master/Printer/RawPrinterHelper.cs)通过USB将原始ZPL打印命令通过USB发送到Zebra标签打印机。在Windows上可以正常工作。
我在Raspbian上遇到以下错误:
System.DllNotFoundException: winspool.Drv
at (wrapper managed-to-native) App.RawPrinterHelper:OpenPrinter (string,intptr&,intptr)
at App.RawPrinterHelper.SendBytesToPrinter (System.String szPrinterName, System.IntPtr pBytes, System.Int32 dwCount) [0x00032] in <8ba638cb2422469187f74f936946c4cb>:0
at App.RawPrinterHelper.SendStringToPrinter (System.String szPrinterName, System.String szString) [0x0000f] in <8ba638cb2422469187f74f936946c4cb>:0
我已经搜索了类似的问题,并且在Mono的网站上找到了一篇文章,建议使用MONO_LOG_LEVEL来查看Mono正在查找的文件,然后在/usr
中搜索这些文件。我在日志中得到以下文件名,但是在/usr
中找不到这些文件名。
Mono: DllImport attempting to load: 'winspool.Drv'.
Mono: DllImport error loading library '/usr/lib/libwinspool.Drv': '/usr/lib/libwinspool.Drv: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/usr/lib/libwinspool.Drv.so': '/usr/lib/libwinspool.Drv.so: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library 'libwinspool.Drv': 'libwinspool.Drv: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library 'libwinspool.Drv.so': 'libwinspool.Drv.so: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library 'winspool.Drv': 'winspool.Drv: cannot open shared object file: No such file or directory'.
谢谢。
答案 0 :(得分:0)
此代码仅适用于Windows,并使用p / invoke调用Windows API。您将需要找到一种与Raspbian上的设备进行通信的替代方法。