Monday, April 28, 2014

print image

using System.Drawing;
using System.Drawing.Printing;

void testPrint()
{
 PrintDocument pd = new PrintDocument();
 pd.PrintPage += (thesender, ev) => {
  ev.Graphics.DrawImage(Image.FromFile("Your Image Path"), 
  //This is to keep image in margins of the Page.
  new PointF(ev.MarginBounds.Left,ev.MarginBounds.Top));
     };
 pd.Print();
}

No comments: