title: print RichTextBox
body: <p>Set Picture</p>
  
  <pre><code>Image image = Image.FromFile(@"C:\a.jpg");
  Clipboard.SetImage(image);
  richTextBox1.Paste();
  </code></pre>
  
  <p>Text Print</p>
  
  <pre><code>PrintDialog printDialog = new PrintDialog();
  PrintDocument documentToPrint = new PrintDocument();
  printDialog.Document = documentToPrint;
  if (printDialog.ShowDialog() == DialogResult.OK)
  {
      StringReader reader = new StringReader(richTextBox1.Text);
      documentToPrint.PrintPage += new PrintPageEventHandler(DocumentToPrint_PrintPage);
      documentToPrint.Print();
  }
  
  
  private void DocumentToPrint_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
  {
      StringReader reader = new StringReader(richTextBox1.Text);
      float LinesPerPage = 0;
      float YPosition = 0;
      int Count = 0;
      float LeftMargin = e.MarginBounds.Left;
      float TopMargin = e.MarginBounds.Top;
      string Line = null;
      Font PrintFont = this.richTextBox1.Font;
      SolidBrush PrintBrush = new SolidBrush(Color.Black);
  
      LinesPerPage = e.MarginBounds.Height / PrintFont.GetHeight(e.Graphics);
  
      while (Count &lt; LinesPerPage &amp;&amp; ((Line = reader.ReadLine()) != null))
      {
          YPosition = TopMargin + (Count * PrintFont.GetHeight(e.Graphics));
          e.Graphics.DrawString(Line, PrintFont, PrintBrush, LeftMargin, YPosition, new StringFormat());
          Count++;
      }
  
      if (Line != null)
      {
          e.HasMorePages = true;
      }
      else
      {
          e.HasMorePages = false;
      }
      PrintBrush.Dispose();
  }
  </code></pre>
  
  <p>This code only print text in richtextbox but
  how can print text and image in the richtextbox?</p>