473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PrinterSettings from System.Drawing.Printing

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
Nov 22 '05 #1
3 4408
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.

Nov 22 '05 #2
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/en...sclasstopic.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
Nov 22 '05 #3
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.

Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BJS | last post by:
Sorry for the cross-posting, but based on the number of people I have seen ask for a solution to this problem, I hope by cross-posting this, that it will help a lot of people out of a common...
3
by: RBisch | last post by:
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...
3
by: Steve Hanna | last post by:
I am having problems using the Printer Dialog to set PrinterSettings, specifically the landscape property of the DefaultPageSettings. Here's the code: <code> Private Sub GetPrinter(ByRef...
3
by: Jochen Kalmbach | last post by:
Hello, if an PrinterSettings-Instance is not set-up correctly (for example just by using the default-constructor), then the "ToString()"_method will throw an exception! Unhandled...
0
by: trint | last post by:
try { // Wait for the report to completely render. if(m_numberOfPages < 1) return false; PrinterSettings printerSettings = new PrinterSettings(); printerSettings.MaximumPage = m_numberOfPages;...
3
by: trint | last post by:
Can someone help me to get this code to work...I'm unsure what the 'printDoc' variable is supposed to be? // Add list of paper sources found on the printer to the combo box. // The DisplayMember...
3
by: moko | last post by:
Can the System.Drawing.Print namespace (and it's print methods) be used in ASP.NET ? Can we direct an output to a printer using these classes ? If not, what is the alternative ?
2
by: Coen | last post by:
Hi, can anyone help me with the printrange functionality? The problem is: whatever I try allways all the pages are print (directly to the printer or via a preview control). The VS-Build in...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
2
by: =?Utf-8?B?RGF2aWQ=?= | last post by:
I’m not sure how to feed PCL commands (i.e. “Ec&l1S”) thru the PrinterSettings() function, but we have been successfully using the PrinterSetting() properties and methods to successfully call...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.