title: Python Reportlab PDF - Centering Text on page
body: <p>I am using <a href="http://www.reportlab.com/software/opensource/" rel="noreferrer">ReportLab</a> to generate a pdf dynamically with python.</p>
  
  <p>I would like a line of text to be centered on a page.  Here is the specific code I currently have, but do not know how to center the text horizontally.  </p>
  
  <pre><code>header = p.beginText(190, 740)
  header.textOut("Title of Page Here")
  
  # I know i can use TextLine etc in place of textOut
  
  p.drawText(header)
  </code></pre>
  
  <p>The text displays and I can manually move the left position so the text looks centered, but I need this to be centered programmatically since the text will be dynamic and I don't know how much text there will be.</p>