如何从.NET打印到串行打印机(例如Epson TM-U210)?
请告诉我如何使用 C# 使用 Epson TM-U210 打印机打印发票。我可以使用普通 USB 打印机(例如 HP 喷墨打印机)打印发票。我用
printDocument1.Print();
命令来打印。但爱普生打印机是串口打印机。是否需要使用端口命令并使用任意字节来写入?请至少指导我。我不知道从哪里开始。太感谢了
Please tell me how to print invoice using Epson TM-U210 printer using C#. I can print invoice using normal USB printer such as HP inkjet printers. I used
printDocument1.Print();
command to print. But Epson printer is serial port printer. There for is there any need of using port command and use any byte to write? Please at least guide me. I don't have any idea to where to start. Thank you so much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当谈到这样的解决方案时,我经常避免实际的通信层。我会模拟您想要发送的输出,并将其发送到您已在本地系统上创建的本地打印机队列。这让 Windows 通过 COM 端口处理通信,并将处理所有低级项目,例如在打印机关闭时使打印队列脱机等。
请查看此处:http://support.microsoft.com/kb/322091
我通常也会对 USB 打印机执行此操作,因此我不必跟踪哪个 USB 端口打印机已打开并且如果纸张用完了,然后 Windows 会处理排队等问题。
When it comes to solutions like this, I often avoid the actual communications layer. I'd mock up the output that you want to to send and fire off to the local printer queue that you've already created on the local system. This let's Windows handle the communication via the COM port and will handle all the low level items such as taking the print queue offline if the printer is off etc.
Take a look here: http://support.microsoft.com/kb/322091
I typically do this for USB printers too so I don't have to keep track of what USB port the printer is on and if it's out of paper then Windows handles the queuing etc.