[C# Helper]
Index Books FAQ Contact About Rod
[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[Beginning Software Engineering]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: Send a printout directly to a specific printer in C#

[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 void btnPrint_Click(object sender, EventArgs e) { // Select the printer. pdocSmiley.PrinterSettings.PrinterName = "HP Deskjet F300 Series"; // Print. pdocSmiley.Print(); }

The code sets the printer's name and then calls the PrintDocument object's Print method to immediately send the printout to that printer.

The PrintDocument object named pdocSmiley has a PrintPage event handler that prints a smiley face. Download the example so see how that and other details work.

Download the example to experiment with it and to see additional details.

© 2009-2022 Rocky Mountain Computer Consulting, Inc. All rights reserved.