开发者

Sending Printer Commands via USB in C#

开发者 https://www.devze.com 2023-01-16 15:47 出处:网络
I have a ticket printer I am trying to send raw print commands to, I am currently开发者_Go百科 sending the commands by pinvoke to winspool.drv and calling WritePrinter. This is working for most of t

I have a ticket printer I am trying to send raw print commands to,

I am currently开发者_Go百科 sending the commands by pinvoke to winspool.drv and calling WritePrinter. This is working for most of the commands I am sending, but I cannot get feedback from the printer this way (for example, the printer has a barcode reader on it, I can send them command read barcode but I cannot receive the data back as it is stopped by the windows spooler).

Is there a way to open a USB port and send a byte[] of commands in C#?

Many Thanks

Shaun


You can exchange data over USB in a similar manner as you read/write to a file. Here's an interesting article on that topic.

Using the windows printer driver has some advantages though. Are you sure you want to do this yourself?

0

精彩评论

暂无评论...
验证码 换一张
取 消