Is it possible, when i open a form with reportviewer
inside to print it automatically without need to press the printer button and without show me printdialog
.
Just to put a code in Form_Load
and to Print it Automatically.
I found this:
Image printimg;
private void Form1_Load(object sender, EventArgs e)
{
printimg = Image.FromStream(new FileStream("path", FileMode.Open));
PrintDocument print = new PrintDocument();
PrinterSettings setting = new PrinterSettings();
//do something
print.PrinterSettings = setting;
print.PrintPage += Print_PrintPage;
print.Print();
}
private void Print_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(printimg, new Point());
}
But which is my path?