title: How to position and center text in PDFsharp?
body: <p>I need the "Job Setup Sheet" centered under the Heading. How should that be done?</p>
  
  <p>Here is what I tried:</p>
  
  <pre><code>// Create an empty page
  PdfPage page = document.AddPage();
  page.Size = PageSize.Letter;
  // Get an XGraphics object for drawing
  XGraphics gfx = XGraphics.FromPdfPage(page);
  
  //XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode,
                                                  PdfFontEmbedding.Always);
  
  // Create a font
  XFont HeadingFont = new XFont("Times New Roman", 20, XFontStyle.Bold);
  XFont BodyFont = new XFont("Times New Roman", 12);
  // Draw the text
  gfx.DrawString("Texas Exterior Systems", HeadingFont, XBrushes.Black,
    new XRect(0, 0, page.Width, page.Height),
    XStringFormats.TopCenter);
  
  gfx.DrawString("Job Setup Sheet", BodyFont, XBrushes.Black,
    new XRect(0, 0, page.Width, page.Height),
    XStringFormats.Center);
  </code></pre>