title: Using pdfrw and ReportLab to add text to an existing PDF and insert
body: <p>I want to use pdfrw and ReportLab to:</p>
  
  <ol>
  <li><p>open an existing PDf and add a line of text to it based on x and y coordinates (via ReportLab - drawCentredString(x,y,string)</p></li>
  <li><p>insert the resulting pdf into my report.</p></li>
  </ol>
  
  <p>So far, here's what I've tried as a modified version of code from <a href="http://www.blog.pythonlibrary.org/2012/07/07/a-quick-intro-to-pdfrw/" rel="nofollow noreferrer">here</a>:</p>
  
  <pre><code>from pdfrw import PdfReader
  from pdfrw.buildxobj import pagexobj
  from pdfrw.toreportlab import makerl
  from reportlab.pdfgen import canvas
  
  folder='Documents/Assets/'
  x = PdfReader(folder+'/'+'BACK_PAGE.pdf',decompress=False).pages
  y = pagexobj(x)
  c = canvas.Canvas(folder+'/'+'BACK_PAGE_out.pdf')
  c.doForm(makerl(c, y))
  c.showPage() 
  c.save()
  </code></pre>
  
  <p>This is just to open the pdf and save it as a new one (baby steps). 
  The problem is, I get this error:</p>
  
  <pre><code>AttributeError: 'list' object has no attribute 'inheritable'
  </code></pre>
  
  <p>Thanks in advance for any insight.</p>
  
  <p>P.S. I know there is a similar question <a href="https://stackoverflow.com/questions/1180115/add-text-to-existing-pdf-using-python">here</a>, but it is old and I can't get the solutions to work.</p>