title: iText 7 - Center align text and paragraphs
body: <p>I'm trying to center align a block of text, however getting inconsistent results. Here is a rough idea of my code:</p>
  
  <pre><code>baseCanvas.ShowTextAligned("Header 1", 555, 839, TextAlignment.CENTER, 0);
  baseCanvas.ShowTextAligned("Test test test ...", 240, 809, TextAlignment.CENTER, 0);
  </code></pre>
  
  <p>Here is the PDF Output:</p>
  
  <p><a href="https://i.stack.imgur.com/QYh9H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QYh9H.png" alt="Output"></a></p>
  
  <p>However I'm trying to achieve the following:
  <a href="https://i.stack.imgur.com/t9kMk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t9kMk.png" alt="Design"></a></p>
  
  <p>I've checked the iText documentation, but is there a way to do this without having to create tables and cells? </p>