for (int i = 0; i < DataGridView1.Rows.Count; i++){e.Graphics.DrawLine( Pen, new Point(818, y), new Point(818, y + 35));e.Graphics.DrawString(DataGridView1.Rows[i].Cells[0].Value.ToString(), new Font("Arial", 16, FontStyle.Bold), Brushes.Black, new Point(770, y + 7), format1);y += 35;if (y > e.PageBounds.Height - 25){ y = 50; e.HasMorePages = true; return; }else{ e.HasMorePages = false; }}
if (y > e.PageBounds.Height - 25)
{ y = 50; e.HasMorePages = true; return; }else{ e.HasMorePages = false; }