'how to print two panel in same form?

Im creating window form app i have two panel in same window form and when user print i want to print in two page panel1 into page1 and panel two in page2. i have tried this code and it prints well one page how to print the second panel in page two?

here is my code

//print fucntion
  private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Margins margins = new Margins(100, 100, 100, 100);
            printDocument1.DefaultPageSettings.Margins = margins;

            Panel grd = new Panel();
            grd = panel1;
            Bitmap bmp = new Bitmap(grd.Width, grd.Height, grd.CreateGraphics());
            printDocument1.DefaultPageSettings.Landscape = true;

            grd.DrawToBitmap(bmp, new Rectangle(0, 0, grd.Width, grd.Height));
            RectangleF bounds = printDocument1.DefaultPageSettings.Bounds;
            e.Graphics.DrawImage(bmp, bounds.Left, bounds.Top, bounds.Width, bounds.Height);
        }

//print button
 private void button1_Click(object sender, EventArgs e)
        {

            printPreviewDialog1.Document = printDocument1; //Associate PrintPreviewDialog with PrintDocument.
            printPreviewDialog1.ShowDialog(); // Show PrintPreview Dialog

        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source