Get Printer Driver By Printer Name Vb Net Data

  1. Double Check The Printer Name And Make Sure
  2. How To Change Printer Name In Windows 10
  3. Get Printer Driver By Printer Name Vb Net Data Software
  4. Get Printer Driver By Printer Name Vb Net Data Centers
  • If I know a printer's name, how can I get these values in C# 2.0? Now updated with 2018 Developer Survey data. How to get Printer Info in.NET?
  • Additionally, it returns a pointer to data allocated by the spooler in lppPrinterNotifyInfo, which contains a PRINTER_NOTIFY_INFO structure, followed by an array of PRINTER_NOTIFY_INFO_DATA structures. Again, in VB.NET these can.
  • If I know a printer's name, how can I get these values in C# 2.0? Stack Overflow new. How much are your skills worth? Find out how much developers like you are making with our Salary Calculator, now updated with 2018 Developer Survey data. Compare salary. Log In Sign Up; current community. Stack Overflow. How to get Printer Info in.NET.
  • I am using this code which I got off the net. I am trying to send a txt file to an Intermec PM4i label printer that takes RAW data and prints out labels. I have loaded the driver and have set up the.
  • Apr 27, 2004  Getting Printer Port in VB.NET. Now my requirement is to get the Printer Name, Printer Port and Printer Driver for the Printer, which user has selected. I am able to get the PrinterName through PrinterSettings.PrinterName, but not able to get the PrinterPort and PrinterDriver.

Get Default printer information with VB.Net.!! You can get information for each of the printers by constructing a new PrinterSettings class and setting. How to select the drivername, printername and portname of a printer to use in the SelectPrinter-command of craxdrt.Report I made a report in Crystal Reports 9.0 Now I want to print the report in VB.NET and want to set the correct printer without prompting for the printername in runtime.

Active3 months ago

I need to get the default printer name. I'll be using C# but I suspect this is more of a framework question and isn't language specific.

Kevin Gale
Kevin GaleKevin Gale
2,6206 gold badges25 silver badges30 bronze badges

7 Answers

The easiest way I found is to create a new PrinterSettings object. It starts with all default values, so you can check its Name property to get the name of the default printer.

PrinterSettings is in System.Drawing.dll in the namespace System.Drawing.Printing.

Alternatively, you could maybe use the static PrinterSettings.InstalledPrinters method to get a list of all printer names, then set the PrinterName property and check the IsDefaultPrinter. I haven't tried this, but the documentation seems to suggest it won't work. Apparently IsDefaultPrinter is only true when PrinterName is not explicitly set.

OwenPOwenP
18.2k13 gold badges61 silver badges84 bronze badges

Another approach is using WMI (you'll need to add a reference to the System.Management assembly):

Nathan BaulchNathan Baulch
16.4k4 gold badges44 silver badges48 bronze badges

If you just want the printer name no advantage at all. But WMI is capable of returning a whole bunch of other printer properties:

and not just printers. If you are interested in any kind of computer related data, chances are you can get it with WMI. WQL (the WMI version of SQL) is also one of its advantages.

Uros Calakovic

I use always in this case the System.Printing.LocalPrintServer, which makes also possible to obtain whether the printer is local, network or fax.

or using a static method GetDefaultPrintQueue

Alexander ZwitbaumAlexander Zwitbaum
2,5442 gold badges37 silver badges49 bronze badges
Ramgy BorjaRamgy Borja
1,1302 gold badges10 silver badges30 bronze badges
  • 1st create an instance of the PrintDialog object.
  • then call the print dialog object and leave the PrinterName blank. this will cause the windows object to return the defualt printer name
  • write this to a string and use it as the printer name when you call the print procedure

Code:

Double Check The Printer Name And Make Sure

GetJoe McBride
3,2542 gold badges25 silver badges33 bronze badges
DieselDog

This should work:

using System.Drawing.Printing;

PrinterSettings settings = new PrinterSettings();string defaultPrinterName = settings.PrinterName;

TahirTahir

Not the answer you're looking for? Browse other questions tagged .net or ask your own question.

Active10 years, 1 month ago

I'd like to be able to specify two different printers for two different jobs. I'm using the following class to handle printing these, but regardless of what I do, the default printer is always the one that's printed to.

If I inspect my PrinterSettings attribute immediately before the call to DrawString, the PrinterName attribute is still correctly set to the printer I specify, but it's still the default printer that kicks out the job. I'm sure I'm missing something obvious, but would certainly appreciate if someone could point out what it is. :)

Thanks

Canon speedlite 199a flash

PrinterBlumerBlumer
4,6002 gold badges28 silver badges46 bronze badges

2 Answers

I just created a test app with the class code you posted and it works fine. It uses whatever printer I select. So I must conclude that wherever you are using this class you're accidentally altering the PrintSettings object after you initialize the object but before you call Print.

Or perhaps the printer name you specify isn't valid and the default is used as a backup. You can check this using PrinterSettings.IsValid after setting the PrinterName property.

How To Change Printer Name In Windows 10

CorinCorin
1,5012 gold badges23 silver badges38 bronze badges

The PrinterSettings.PrinterName property is actually what you should be using.

You can get a list of installed printers using PrinterSettings.InstalledPrinters (System.Drawing.Printing namespace). Perhaps your provider printer name is slightly different from what it should be, because I can confirm this actually works.

ThorarinThorarin

Get Printer Driver By Printer Name Vb Net Data Software

38.6k9 gold badges62 silver badges105 bronze badges

Get Printer Driver By Printer Name Vb Net Data Centers

Not the answer you're looking for? Browse other questions tagged vb.netprintingdefault or ask your own question.