Category Archives: printing

Print a ListView control’s contents on multiple pages in C#

This example continues the following two examples: Print a ListView with large contents in C# Print the contents of a ListView control in C# Read those examples for an overview of the basic procedure. This example prints the contents of … Continue reading

Posted in controls, extension methods, printing | Tagged , , , , , , , , , , , , , | 4 Comments

Print a ListView with large contents in C#

The example Print the contents of a ListView control in C# explains how to print the data in a ListView control when its View property is set to Details. One difficulty when printing this kind of data is that a … Continue reading

Posted in controls, drawing, graphics, printing | Tagged , , , , , , , , , , , , , , | Leave a comment

Print the contents of a ListView control in C#

The ListView control, like most controls, includes no support for printing. If you want to display a ListView control’s contents on a print out, you need to do all of the printing yourself. Unfortunately printing in C# is extremely flexible … Continue reading

Posted in controls, drawing, graphics, printing | Tagged , , , , , , , , , , , , | 24 Comments

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

Restart the print spooler in C#

Every now and then my computer gets confused and thinks the printer is offline. That wouldn’t be so bad except Windows doesn’t provide a simple way to bring the printer back online. Basically you need to shutdown and restart the … Continue reading

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

Print images in C#

This example shows a simple way to print images. When you print, the PrintDocument object’s PrintPage event handler provides a Graphics object named e.Graphics. That object’s DrawImage method can draw a picture on the printed surface. To print an image, … Continue reading

Posted in graphics, image processing, printing | Tagged , , , , , , , , , , | Leave a comment

Print at full scale in C#

This example shows how you can print at full scale so objects drawn on the screen are the same size when printed. Note that your screen and printer are probably not calibrated exactly so the result will not match perfectly. … Continue reading

Posted in drawing, GDI+, graphics, printing | Tagged , , , , , , , , , , , , , , , , | 2 Comments