How to find printer attributes

  • Thread starter Thread starter active
  • Start date Start date
A

active

In a program how do I find out things about the default printer, like page
orientation, paper size, margin offset etc. ?

So much is new in dotnet. I'm overwhelmed trying to convert from VB6!!

Thanks in advance
Cal
 
* " active said:
Sure sounds like it. I'll give it a try.

If you want more information about the printer, you may want to use
'PrinterSettings.GetHdevmode', but this is more advanced...
 
That is useful info. I've found most of what I need except the offsets
(i.e., the space at the paper edges that the printer can not print on.) I'm
still looking and am quite sure I'll find that.

However, I'd appreciate it if you'd confirm or deny the following: The only
way to find the name of the default printer is to loop through all installed
printer to see which one is marked as the default.

I'd hate to loop if there is a more direct way.

Thanks for all the help
Cal
 
I missed Printername last time I looked. I think the follow works.



Dim pd As New PrintDocument

Debug.WriteLine(pd.PrinterSettings.PrinterName)


Thanks
Cal
 
* " active said:
That is useful info. I've found most of what I need except the offsets
(i.e., the space at the paper edges that the printer can not print on.) I'm
still looking and am quite sure I'll find that.

See:

However, I'd appreciate it if you'd confirm or deny the following: The only
way to find the name of the default printer is to loop through all installed
printer to see which one is marked as the default.

That's a managed way to do that.
 
Cal,
You will have to PInvoke GetDeviceCaps to get the physical margins of
the printer. This is a fairly simple call and I believe that MSDN magazine
had an article on it during 2002 (although I can't seem to find it in the
online search). If you would like I have a (C#) short routine that I can
send you that does this. This shouldn't be too hard to translate into
VB.NET or you could just compile and use it as a linked module.

Ron Allen

active said:
That is useful info. I've found most of what I need except the offsets
(i.e., the space at the paper edges that the printer can not print on.) I'm
still looking and am quite sure I'll find that.

However, I'd appreciate it if you'd confirm or deny the following: The only
way to find the name of the default printer is to loop through all installed
printer to see which one is marked as the default.

I'd hate to loop if there is a more direct way.

Thanks for all the help
Cal
 
Ron Allen said:
Cal,
You will have to PInvoke GetDeviceCaps to get the physical margins of
the printer. This is a fairly simple call and I believe that MSDN magazine
had an article on it during 2002 (although I can't seem to find it in the
online search). If you would like I have a (C#) short routine that I can
send you that does this. This shouldn't be too hard to translate into
VB.NET or you could just compile and use it as a linked module.

Ron Allen

Yes Thanks. Remove REMOVE from my address

Cal
 
Back
Top