Category Archives: printers

Select and print multiple files in C#

This example lets you easily print multiple files. You can use it, for example, to print all of the .cs files in a project’s directory. Select a printer from the ComboBox at the top. Enter or select a directory and … Continue reading

Posted in files, printers, printing, system | Tagged , , , , , , , , , , , , | 7 Comments

Set a print job name in C#

By default, when you send a PrintDocument to a printer, the printer spool shows the job’s name as “document.” You can change the print job name by setting the PrintDocument object’s DocumentName property. This example uses the following code to … Continue reading

Posted in printers, printing, system | Tagged , , , , , , , , , , , , , | 1 Comment

Print a text file in C#

This example lets you select a printer and file, and then print the file on the selected printer. (Actually this version just displays a print preview. To send the file directly to the selected printer, see the example Send a … Continue reading

Posted in printers, printing, system | Tagged , , , , , , , , , , , , , , , , , | 2 Comments

Select printer resolution in C#

This example shows how to let the user select a printer resolution. When you set a PrintDocument object’s printer, its DefaultPageSettings.PrinterSettings.PrinterResolutions collection contains PrinterResolution objects representing the printer’s available resolutions. For example, you can select one of these to print … Continue reading

Posted in printers, printing | Tagged , , , , , , , , | Leave a comment

Let the user select a printer and then send a printout directly to it in C#

When it starts, the program uses the following code to list the available printers in a ComboBox. // List the available printers. private void Form1_Load(object sender, EventArgs e) { foreach (string printer in PrinterSettings.InstalledPrinters) cboPrinter.Items.Add(printer); } This code loops through … Continue reading

Posted in printers, printing | Tagged , , , , , , , , , , | Leave a comment

Send a printout directly to a specific printer in C#

To send a printout directly to a specific printer, simply set the PrintDocument object’s PrinterSettings.PrinterName property to the printer’s name. This example uses the following code to print directly to the printer named “HP Deskjet F300 Series.” // Print. private … Continue reading

Posted in printers, printing | Tagged , , , , , , , , | 3 Comments

Use WMI to get detailed printer information in C#

This example shows how you can use WMI to get printer information for the printers installed on your system. When the program loads, it uses the following code to list the system’s installed printers. // List the installed printers. private … Continue reading

Posted in printers, system, WMI | 1 Comment