From: pers on
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.


From: Peter Duniho on
pers wrote:
> 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
From: Anders Eriksson on
Hello,

Have you looked at the doc?
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.papersizes.aspx

a PrintDocument variable named printDoc exists
printDoc.PrinterSettings.PaperSizes.Count

// Anders
"pers" <rezarms(a)hotmail.com> skrev i meddelandet
news:eWwJZW1vKHA.5940(a)TK2MSFTNGP02.phx.gbl...
> 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.
>
>

From: pers on
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?

"Peter Duniho" <no.peted.spam(a)no.nwlink.spam.com> wrote in message
news:ebeGQ$1vKHA.404(a)TK2MSFTNGP02.phx.gbl...
> pers wrote:
>> 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
>


From: Peter Duniho on
pers wrote:
> 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