从打印机获取纸张传感器状态 - c# [英] get from the printer, the paper sensor status - c#

查看:267
本文介绍了从打印机获取纸张传感器状态 - c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到现在我发送命令到打印机,fullCut,WriteBytes等所有这些命令都没有返回值。



现在我需要接收一个字节数组状态。





例如:

向打印机发送全部切割:

Until now i sended commands to printer, fullCut, WriteBytes, etc all of them has no return value.

now i need to receive a byte array with the status.


example:
send full cut to printer:

public override bool SendCommandFullCut()
        {
            return this.SendCommandToPrinter(new byte[] { 0x1C, 0xC0, 0x34 });
        }





它是十六进制代码。



并且,检查状态是相同的。我需要检查是否有纸,或者是否接近完成它。





请帮忙吗?

非常感谢



it is an hexadecimal code.

and, the check status is the same. i need to check if there is paper, or if is near to finish it.


Any help please?
thank you very much

推荐答案

请参阅http://msdn.microsoft.com/en-us/library/system.printing.printqueuestatus(v=vs .90).aspx或Googlec#从打印机获取纸张状态
See http://msdn.microsoft.com/en-us/library/system.printing.printqueuestatus(v=vs.90).aspx or Google "c# get paper status from printer"


我必须通过串口执行此操作。





您可以使用USB端口虚拟化串口:



- 连接到USB端口的适配器

- 安装te驱动程序并选择新创建的虚拟化串口(在我的情况下为COM3)

- 在控制面板打印机窗口中卸载打印机(退出设备)

- 退出打印机是非常重要的,因为如果没有,打印机会占用端口,当你尝试打开端口时会出错(给定的端口名称不是以COM / com开头的或者没有解析为有效的串口)





尝试一下。它很棒。



http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-。 NET.aspx [ ^ ]





PS。感谢所有人!
I have to do this by the serial port.


You can "virtualize" a serial port using the USB port:

- connect with an adapter to de USB port
- install te drivers and select a new created virtualized serial port (in my case COM3)
- uninstall the printer in the control panel printer window (quit device)
- is very important to quit the printer because if not, the port is taken by the printer and when you're trying to open the port will be an error ("The given port name does not start with COM/com or does not resolve to a valid serial port")


try it. it works great.

http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-.NET.aspx[^]


PS. Thx to all!


这篇关于从打印机获取纸张传感器状态 - c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆