简体   繁体   English

如何判断打印机是否打印到文件?

[英]How can I tell if a printer will print to file?

I have a .net 2.0 application (c#) with one component running as a service and a UI for configuring the service. 我有一个.net 2.0应用程序(c#),其中一个组件作为服务运行,一个UI用于配置服务。

The UI provides a way for the user to select a printer which will be used by the service. UI为用户提供了一种选择将由服务使用的打印机的方法。

I want the UI to filter out any printers which are configured to print to file becasue these pritners will cause problems for the service (a 'save as' dialog will open but the dialog is invisible becasue it belongs to the service). 我希望UI过滤掉任何配置为打印到文件的打印机,因为这些pritners会导致服务出现问题(“另存为”对话框将打开但对话框因其属于服务而不可见)。

The problem is that I can't find any method to detect a printer which is set to print to file. 问题是我找不到任何方法来检测设置为打印到文件的打印机。

System.Drawing.Printing.PrinterSettings has a property called PrintToFile, but this is always set to false! System.Drawing.Printing.PrinterSettings有一个名为PrintToFile的属性,但始终设置为false!

PrinterSettings.PrintToFile can only be set by System.Windows.Forms.Printing.PrintDialog class. PrinterSettings.PrintToFile只能由System.Windows.Forms.Printing.PrintDialog类设置。 The Print to file option only appears on the System.Windows.Forms.Printing.PrintDialog when the System.Windows.Forms.Printing.PrintDialog.AllowPrintToFile property is set to true. 当System.Windows.Forms.Printing.PrintDialog.AllowPrintToFile属性设置为true时,“打印到文件”选项仅出现在System.Windows.Forms.Printing.PrintDialog上。

Hope that solves your problem. 希望能解决你的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM