Send a printout directly to a specific printer in C#

[specific printer]

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.

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 Example   Follow me on Twitter   RSS feed   Donate

This entry was posted in printers, printing and tagged , , , , , , , , . Bookmark the permalink.

3 Responses to Send a printout directly to a specific printer in C#

  1. Hello, I desire to subscribe for this webpage to obtain hottest updates, so where can i do it please help.

  2. RodStephens says:

    Between the Download and Donate buttons are two you can use to subscribe in different ways.

    The blue bird lets you subscribe to my Twitter feed. When I post new material, I mention it there.

    The green button lets you subscribe with an RSS reader.

  3. Pingback: Print a text file in C# - C# HelperC# Helper

Comments are closed.