Currently I am using the following code to print an image:
private void button9_Click(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
printpath = "C:\\temp.bmp";
pd.PrintPage += new PrintPageEventHandler(Print_Page);
PrintPreviewDialog dlg = new PrintPreviewDialog();
dlg.Document = pd;
dlg.ShowDialog();
pd.Print();
}
private void Print_Page(object o, PrintPageEventArgs e)
{
Image i = Image.FromFile(printpath);
Point p = new Point(0, 0);
e.Graphics.DrawImage(i, p);
}
But if the image has a too large height, it doesn't fit the page. I want to split the image into pieces with height of 1125px and then show them on multiple pages in Print Preview. How do I do this? Thanks!