PrinterSettings from System.Drawing.Printing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am finding that some of the properties off of the PrinterSettings object are misleading

For example,
When I test the CanDuplex on a printer I know duplexes, the property is false. Another one is DefaultPrinter, it is set to false when I know that I have that printer set as default (I verify via the "Printers and Fax" applet

Can anyone confirm or explain

TIA
 
Hi RBisch,

Based on my understanding, you find PrinterSettings.CanDuplex and
PrinterSettings.IsDefaultPrinter properties to be wrong on your machine.

PrinterSettings.CanDuplex detects whether the printer you use supports
Duplex printing, while PrinterSettings.Duplex property will tell your
current setting for printer(You may use single side printing for a printer
which supports duplex printing).

PrinterSettings.IsDefaultPrinter indicats whether the PrinterName property
designates the default printer, except when the user explicitly sets
PrinterName.

I have tested these 2 properties on my side, which has no problem, my
network printer support duplex printing and I use the default printer, so
in my test program, these 2 prooperties both return true.

I also have searched external and internal resource and I did not find any
unknown issue or any other people meet your problem. So can you paste some
code snippet for me to reproduce the problem?

Also, just as MSDN document said, if you explicit set the PrinterName, the
PrinterSettings.IsDefaultPrinter will become "false", even you set the
PrinterName to the default printer.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Yes you are correct. Also, if you probe the printerSettings before setting PrinterName you get default settings as you stated, however in the code execution if you set PrinterName, you then get all settings respective to the printer pointed to by PrinterName. This is not explicitly stated in the MSDN help, it should be stated that anytime during code execution you change the PrinterName, the PrinterSettings will then represent that printer designated by PrinterName. More specifically I think it would be helpful to have this in the Remarks section of PrinterSettings

msdn: http://msdn.microsoft.com/library/e...emdrawingprintingprintersettingsclasstopic.as

My code works now as I expect it, this is a console app with System.Drawing.Printing added as a reference

using System
using System.Drawing.Printing

namespace ProbePrinter
{
class Class

PrinterSettings settings

public Class1(

settings = new PrinterSettings()


[STAThread
static void Main(string[] args

Class1 printerSettings = new Class1()
printerSettings.DefaultSettings()
printerSettings.SetPrinterSettings()
Console.Read()


void DefaultSettings(

Console.WriteLine("Printer name:{0} Printer defualt:{1} Printer duplex:{2}",
settings.PrinterName, settings.IsDefaultPrinter, settings.CanDuplex)


void SetPrinterSettings(

settings.PrinterName = @"\\rdsprint\Toshiba e-Studio55"
Console.WriteLine("Printer name:{0} Printer defualt:{1} Printer duplex:{2}",
settings.PrinterName, settings.IsDefaultPrinter, settings.CanDuplex)




Thanks for your time and expertise in the .NET Framework

Best Regards
RBisc
 
Hi RBisch,

Thanks for your feedback.

I am glad my reply makes sense to you. I think the "unclear document" is
because the MSDN default believes we think in this way. :-)

Anyway, if you need further help, please feel free to post.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top