Print images c#.net

The Code below uses the PrintDocument object which you can place an image on to the printdocument and then print it.

using System.Drawing.Printing;
...
protected void btnPrint_Click(object sender, EventArgs e)
{
    PrintDocument pd = new PrintDocument();
    pd.PrintPage += PrintPage;
    pd.Print();       
}

private void PrintPage(object o, PrintPageEventArgs e)
{
    System.Drawing.Image img = System.Drawing.Image.FromFile("https://stackoverflow.com/questions/5750659/D:\Foto.jpg");
    Point loc = new Point(100, 100);
    e.Graphics.DrawImage(img, loc);     
}

Leave a Comment

tech