title: Printing to Multiple Pages
body: <p>The code below that can nicely print image and text.</p>
  
  <p>The problem now is, how can I automatically move printing to next page when a page is filled.</p>
  
  <p>Will be nice to add a page number, too:</p>
  
  <pre><code>Public Class Form1
  
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      PrintPreviewDialog1.Document = PrintDocument1
      PrintPreviewDialog1.ShowDialog()
    End Sub
  
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      PrintDocument1.Print()
    End Sub
  
    Private Sub printDocument1_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument1.PrintPage
      Dim rect1 As Rectangle = New Rectangle(New Point(0, 0), PictureBox1.Image.Size)
      Dim rect2 As Rectangle = New Rectangle(New Point(100, 200), PictureBox1.Image.Size)
      Dim fmt As StringFormat = New StringFormat()
      e.Graphics.DrawImage(PictureBox1.Image, rect1)
      e.Graphics.DrawString(RichTextBox1.Text, RichTextBox1.Font, New SolidBrush(Color.Red), rect2, fmt)
    End Sub
  
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      For S = 1 To 200
        RichTextBox1.AppendText("Test Line No. - " &amp; S &amp; vbCrLf)
      Next
    End Sub
  
  End Class
  </code></pre>