@Jay-R Hayashi , Based on my further test, I managed to solve the problem. When we set e.HasMorePages = true; every time, it will generate a new page.
Please refer to the following code.
int m_CurrentPage = 0;
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int offsety = 55;
int fontheight = 200;
for (int i = m_CurrentPage; i < dataGridView1.Rows.Count - 1; i++)
{
if (offsety > e.MarginBounds.Height)
{
e.HasMorePages = true;
offsety = 55;
return;
}
byte[] arr = (byte[])dataGridView1.Rows[i].Cells[0].Value;
var image = byteArrayToImage(arr);
e.Graphics.DrawImage(image, 620, offsety, 120, 120);
offsety += fontheight;
m_CurrentPage++;
}
e.HasMorePages = false;
}
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.