Tag Archives: printer

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 , , , , , , , , , , , , | 11 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

Determine the default printer in C#

When this example starts, the following code lists the printers and selects the default printer. private void Form1_Load(object sender, EventArgs e) { // Find all of the installed printers. foreach (string printer in PrinterSettings.InstalledPrinters) { cboPrinter.Items.Add(printer); } // Find and … Continue reading

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

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