简体   繁体   中英

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.

The UI provides a way for the user to select a printer which will be used by the service.

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).

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!

PrinterSettings.PrintToFile can only be set by System.Windows.Forms.Printing.PrintDialog class. 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.

Hope that solves your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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