简体   繁体   中英

C# - Receive data from Zebra Printer

I am currently developing a Windows Forms application that will print to a Zebra Printer. Using a barcode scanner for input, the application receives a unique identifier and then pings our database to gather information pertaining to the identifier.

The current set-up includes a barcode scanner connected via USB to a PC. A Zebra ZT410 Printer on the network via wired connection. The PC is on the network via wireless connection.

The PC is running the Windows Forms application. When a barcode is scanned, the application queries a database, returns pertinent information, and then sends ZPL code to the printer containing the information to be printed. It works perfectly.

The current hurdle we are trying to overcome is completing this process without the need for a PC intermediary. The scanner plugs directly into the printer but I'm unaware of how to read scans from the scanner through the printer and ultimately over the network and into the application. Is this possible? If so, how might I go about it?

I didn't include any code because I didn't believe it was needed, but I can provide what I have if necessary.

From my work with Zebra printers, I don't think this is possible at the current time.

Ideally; what you could probably do is refactor out all your code into a web service of sorts, and then post your scan to it. The service would return the ZPL code. (and depending on your network setup; possibly include the printer IP and have the service print to it directly)

However, all that is assuming that the printer has some ability to post to the service; which I'm currently unaware of. That's really your gating problem; the PC does all the coordination, and there's nothing available (as far as i know) to replace it.

Given the way you've described it, the PC is not an "intermediary" - it's a critical part of the business process that performs actual work (querying the database and generating ZPL).

Given this, it is not possible to eliminate the PC. Zebra printers do not contain a user-accessible environment that is able to run code that could query a database, for example.

However, if your barcode scanner is a smart-device running Windows CE or something, then yes, you could eliminate the PC by moving the business-logic and database access code to the handheld and then connecting to the Zebra printer over WiFi. You would generate ZPL on your device and send it to the printer over some connection. There are no Windows CE printer drivers for Zebra's printers (that I know of) but I understand you can use ZPL over a socket connection or a serial connection from userland without the need for a driver.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM