C#获取本机连接的打印机属性
来源:互联网 发布:女神联盟女神进阶数据 编辑:程序博客网 时间:2024/05/22 21:26
注意:这里取到的信息是本机连接上,并且装过驱动的打印机信息,也就是在 开始-----打印机和传真 中列出的所有打印机属性。而不是随便将一个打印机的数据线连接到电脑上的情况。另外,如果本机连接的一个能够使用的打印机,某一天去掉数据线后,他仍然在 开始-----打印机和传真 中有图标时,仍然可以获取到信息,而且打印机状态是“空闲”。
界面很简单,一个comboBox,一个textBox
首先在引用中需要引入System.Management,还要using System.Management;
获取当前电脑识别的打印机名
获取打印机的所有属性:
属性如下:
Attributes : 2584
Availability :
AvailableJobSheets :
AveragePagesPerMinute : 0
Capabilities : System.UInt16[]
CapabilityDescriptions : System.String[]
Caption : //print/Canon MF3200 Series
CharSetsSupported :
Comment :
ConfigManagerErrorCode :
ConfigManagerUserConfig :
CreationClassName : Win32_Printer
CurrentCapabilities :
CurrentCharSet :
CurrentLanguage :
CurrentMimeType :
CurrentNaturalLanguage :
CurrentPaperType :
Default : False
DefaultCapabilities :
DefaultCopies :
DefaultLanguage :
DefaultMimeType :
DefaultNumberUp :
DefaultPaperType :
DefaultPriority : 0
Description :
DetectedErrorState : 0
DeviceID : //print/Canon MF3200 Series
Direct : False
DoCompleteFirst : True
DriverName : Canon MF3200 Series
EnableBIDI : True
EnableDevQueryPrint : False
ErrorCleared :
ErrorDescription :
ErrorInformation :
ExtendedDetectedErrorState : 0
ExtendedPrinterStatus : 2
Hidden : False
HorizontalResolution : 600
InstallDate :
JobCountSinceLastReset : 0 //当前任务数
KeepPrintedJobs : False
LanguagesSupported :
LastErrorCode :
Local : False
Location :
MarkingTechnology :
MaxCopies :
MaxNumberUp :
MaxSizeSupported :
MimeTypesSupported :
Name : //print/Canon MF3200 Series
NaturalLanguagesSupported :
Network : True
PaperSizesSupported : System.UInt16[]
PaperTypesAvailable :
Parameters :
PNPDeviceID :
PortName : USB001
PowerManagementCapabilities :
PowerManagementSupported :
PrinterPaperNames : System.String[]
PrinterState : 0 //打印机状态
PrinterStatus : 3
PrintJobDataType : RAW
PrintProcessor : WinPrint
Priority : 1
Published : False
Queued : False
RawOnly : False
SeparatorFile :
ServerName : //print
Shared : True
ShareName : CanonMF3
SpoolEnabled : True
StartTime :
Status : Unknown
StatusInfo :
SystemCreationClassName : Win32_ComputerSystem
SystemName : //print
TimeOfLastReset :
UntilTime :
VerticalResolution : 600
WorkOffline : False //是否离线
其中PrinterState的对应关系如下:
- C#获取本机连接的打印机属性
- C#获取本机连接的Oracle服务名
- 获取本机的全部环境属性
- 获取本机连接的wifi名
- C#获取本机当前连接的无线路由的ssid
- C#获取本机当前连接的无线路由的ssid (vista)
- C#枚举系统安装的所有打印机.获取打印机名称
- C#获取本机的MAC地址
- C#获取本机的MAC地址
- C# 获取本机的COM串口
- C#获取本机安装的字体
- C#获取本机的IP地址
- C#获取本机的MAC地址
- C# 获取本机的串口号
- c#获取本机的MAC
- c#获取本机的串口列表
- C#获取打印机状态的问题
- C#获取打印机
- 10个你也许不知道的Ubuntu技巧
- SVN操作
- Servlet线程安全相关问题
- luabind常用方法总结
- 解决awstats跨月分析日志问题及其他改进
- C#获取本机连接的打印机属性
- 怎样远程连接服务器上的MySql?
- 临时表空间过大的处理,对用户表空间操作。
- Hibernate 的一些注意点
- How to read file in Java – BufferedInputStream Example
- sql操作日期大全
- parse and display a BMP image in the Flash Player using the ByteArray class
- 介绍Java如何获得文件编码格式
- 使用BeanUtils时,Date类型值为空的解决方法