如何在WPF中获取/设置默认打印机(即System.Printing命名空间) [英] How to get/set Default Printer in WPF (i.e. System.Printing namespace)

查看:1060
本文介绍了如何在WPF中获取/设置默认打印机(即System.Printing命名空间)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找确定WPF(System.Printing)名称空间中默认打印机的方法.该名称空间提供有关打印服务器,队列和作业的许多详细信息,但不提供打印机本身.

I'm looking for the method to determine the default printer in the WPF (System.Printing) namespace. This namespace provides many details about print servers, queues and jobs, but not the printer itself.


System.Drawing.Printing命名空间似乎适合WinForms ...


System.Drawing.Printing namespace seems to be geared for WinForms...

我不喜欢WMI中的所有魔术.我只是在寻找一个已经抽象了所有细节的对象.

I don't like all the magic strings in WMI. I'm just looking for an object that already abstracts all the details.

 

如果我可以进一步扩展这个问题,我也在System.Printing名称空间中寻找打印机状态(离线"),但是该名称空间适用于打印假脱机,队列和作业. ..

If I can stretch this question a bit further, I'm also looking for the printer status ("Offline") in the System.Printing namespace... but that namespace is geared towards print spools, queues and jobs...

 

thx sbc

推荐答案

您可以使用 System.Windows.Controls.PrintDialog

You can use the System.Windows.Controls.PrintDialog

printDialog.PrintQueue.QueueStatus

printDialog.PrintQueue.QueueStatus

printDialog.PrintQueue.ShareName

printDialog.PrintQueue.ShareName

 


这篇关于如何在WPF中获取/设置默认打印机(即System.Printing命名空间)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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