title: Measuring Text Height within a rectangle PDFsharp
body: <p>I am trying to layout a PDF document using <code>PDFsharp</code>. I'm wondering how to return the height of text after it is wrapped within a rectangle. So that I can draw a string immediately under the previous string.</p>
  
  <p>Any suggestions on how to do this?</p>
  
  <pre><code>private static readonly XRect LeftRect = new XRect(10, 45, 290, 370);
  
  public static void BuildLeftRect(this XGraphics gfx)
  {
      var tf = new XTextFormatter(gfx);
      gfx.DrawRectangle(XPens.Black, LeftRect);
      tf.DrawString(GenerateAVeryLongString(), HeadingFont, XBrushes.Black, LeftRect, XStringFormats.TopLeft);
      var textMeasurement = gfx.MeasureString(GenerateAddressesText(), TextFont);
      //I want to write another string here, but the height of text measurement is the font size, not the wrapped text size. 
      Console.WriteLine(textMeasurement);
  }
  </code></pre>