PaperSizes.Count returns 0

  • Thread starter Thread starter pers
  • Start date Start date
P

pers

Hi All
I have a Hp printer 1280 that is installed in windows 7.
when I use following code to get Paper count.
System.Drawing.Printing.PrinterSettings p = new
System.Drawing.Printing.PrinterSettings();

MessageBox.Show(p.PaperSizes.Count.ToString());

it reutrns 0.I can't print from my programm but printer directly works
fine.
 
System.Drawing.Printing.PrinterSettings p = new
System.Drawing.Printing.PrinterSettings();
p.PrinterName is returned correctly except PaperSize.Count.

my program unser winXp works correctly but Win7.
Is it possible it's caused by Printer driver?
 
pers said:
Hi All
I have a Hp printer 1280 that is installed in windows 7.
when I use following code to get Paper count.
System.Drawing.Printing.PrinterSettings p = new
System.Drawing.Printing.PrinterSettings();

MessageBox.Show(p.PaperSizes.Count.ToString());

it reutrns 0.I can't print from my programm but printer directly works
fine.

Creating a PrinterSettings object from scratch has very little to do
with actually printing from your program. So, while you say "I can't
print from my program", you haven't provided any information that might
help anyone help you fix that problem.

As for the PrinterSettings object itself, what is the PrinterName value
for the PrinterSettings object you get? If your 1280 printer is set as
the default printer, and it's configured properly, you should get a
proper list of paper sizes supported by it. Otherwise, you will get
something else. Possibly an empty list of paper sizes.

Pete
 
pers said:
System.Drawing.Printing.PrinterSettings p = new
System.Drawing.Printing.PrinterSettings();
p.PrinterName is returned correctly except PaperSize.Count.

my program unser winXp works correctly but Win7.
Is it possible it's caused by Printer driver?

Anything's possible, including the use of the wrong driver on Win7.

Unfortunately, even if you'd posted code, diagnosing driver installation
problems over the Internet is practically impossible. But, given that
it usually works, it seems to me that's the most likely explanation.

Pete
 
Back
Top