title: Words going out of page scope will Printing Page by C#
body: <p>I am using the following code</p>
  
  <h3>In HomePg.cs</h3>
  
  <pre><code>public void PrintMethod()
          {
  
              PrintPg print1 = new PrintPg();
  print1.RefrencePro = comboBoxRefrence1.Text;
  print1.print();
              MessageBox.Show("Bill Printed Successfully");
  }
  
  private void Save_Print_Click(object sender, EventArgs e)
          {
  PrintMethod();
  }
  </code></pre>
  
  <h3>In PrintPg.cs</h3>
  
  <pre><code>class PrintPg
      {
  PrintDocument pdoc = null;
  String Reference;
  public string RefrencePro
          {
              set { this.Reference = value; }
              get { return this.Reference; }
          }
  public PrintPg(string Reference)
  {
   this.Refrence = Refrence;
  }
  public void print()
          {
              PrintDialog pd = new PrintDialog();
              pdoc = new PrintDocument();
              PrinterSettings ps = new PrinterSettings();
              Font font = new Font("Courier New", 15);
              PaperSize psize = new PaperSize("Custom", 100, 200);
              //ps.DefaultPageSettings.PaperSize = psize;
              pd.Document = pdoc;
              pd.Document.DefaultPageSettings.PaperSize = psize;
              //pdoc.DefaultPageSettings.PaperSize.Height =320;
              pdoc.DefaultPageSettings.PaperSize.Height = 820;
  
              pdoc.DefaultPageSettings.PaperSize.Width = 520;
  
              pdoc.PrintPage += new PrintPageEventHandler(pdoc_PrintPage);
  
              DialogResult result = pd.ShowDialog();
              if (result == DialogResult.OK)
              {
                  PrintPreviewDialog pp = new PrintPreviewDialog();
                  pp.Document = pdoc;
                  //pp.Dispose();
                  result = pp.ShowDialog();
  
                  if (result == DialogResult.OK)
                  {
                      pdoc.Print();
                  }
              }
          }
          void pdoc_PrintPage(object sender, PrintPageEventArgs e)
          {
              Graphics graphics = e.Graphics;
              Font font = new Font("Courier New", 10);
              float fontHeight = font.GetHeight();
              int startX = 50;
              int startY = 55;
              int Offset = 40;
  graphics.DrawString("Reference:", new Font("Courier New", 14), new SolidBrush(Color.Black), startX, startY + Offset);
              Offset = Offset + 20;
              graphics.DrawString(this.RefrencePro, new Font("Courier New", 6), new SolidBrush(Color.Black), startX, startY + Offset);
              Offset = Offset + 20;
  }
  </code></pre>
  
  <p>It's Printing Perfectly but when I am printing the words are going out of print Page as shown in image. I am printing in Microsoft One Note. Is their any way by which I can restrict this and make my reference in new line (Make reference address multiline) after the Page scope end?</p>
  
  <p><a href="https://i.stack.imgur.com/IODqQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IODqQ.jpg" alt="enter image description here"></a></p>