private void Pd_PrintPageA4(object sender, PrintPageEventArgs e) { //throw new NotImplementedException(); try { Image img = Image.FromStream(streamPrint); Image aaa = bc.ResizeImagetoA4Lan(img); Rectangle m = e.MarginBounds; //m.Width = aaa.Width; //m.Height = aaa.Height; if ((double)aaa.Width / (double)aaa.Height > (double)m.Width / (double)m.Height) // image is wider { m.Height = (int)((double)aaa.Height / (double)aaa.Width * (double)m.Width); } else { m.Width = (int)((double)aaa.Width / (double)aaa.Height * (double)m.Height); } //e.Graphics.DrawImage(img, m); //} e.Graphics.DrawImage(aaa, m); } catch (Exception) { } }