title: Merge Existing PDF into new ReportLab PDF via flowables
body: <p>I have a reportlab <code>SimpleDocTemplate</code> and returning it as a dynamic PDF. I am generating it's content based on some Django model metadata.  Here's my template setup:</p>
  
  <pre><code>buff = StringIO()
  doc = SimpleDocTemplate(buff, pagesize=letter,
                          rightMargin=72,leftMargin=72,
                          topMargin=72,bottomMargin=18)
  Story = []
  </code></pre>
  
  <p>I can easily add textual metadata from the <code>Entry</code> model into the <code>Story</code> list to be built later:</p>
  
  <pre><code>    ptext = '&lt;font size=20&gt;%s&lt;/font&gt;' % entry.title.title()
      paragraph = Paragraph(ptext, custom_styles["Custom"])
      Story.append(paragraph)
  </code></pre>
  
  <p>And then generate the PDF to be returned in the response by calling <code>build</code> on the <code>SimpleDocTemplate</code>:</p>
  
  <pre><code>doc.build(Story, onFirstPage=entry_page_template, onLaterPages=entry_page_template)
  
  pdf = buff.getvalue()
  resp = HttpResponse(mimetype='application/x-download')    
  resp['Content-Disposition'] = 'attachment;filename=logbook.pdf'
  resp.write(pdf)
  return resp
  </code></pre>
  
  <p>One metadata field on the model is a file attachment.  When those file attachments are PDFs, I'd like to merge them into the Story that I am generating; IE meaning a PDF of reportlab "flowable" type.</p>
  
  <p>I'm attempting to do so using <code>pdfrw</code>, but haven't had any luck. Ideally I'd love to just call: </p>
  
  <pre><code>from pdfrw import PdfReader
  pdf = pPdfReader(entry.document.file.path)
  Story.append(pdf)
  </code></pre>
  
  <p>and append the pdf to the existing Story list to be included in the generation of the final document, as noted above.</p>
  
  <p>Anyone have any ideas?  I tried something similar using pagexobj to create the pdf, trying to follow this example:</p>
  
  <p><a href="http://code.google.com/p/pdfrw/source/browse/trunk/examples/rl1/subset.py" rel="noreferrer">http://code.google.com/p/pdfrw/source/browse/trunk/examples/rl1/subset.py</a></p>
  
  <pre><code>from pdfrw.buildxobj import pagexobj
  from pdfrw.toreportlab import makerl
  
  pdf = pagexobj(PdfReader(entry.document.file.path))
  </code></pre>
  
  <p>But didn't have any luck either.  Can someone explain to me the best way to merge an existing PDF file into a reportlab flowable?  I'm no good with this stuff and have been banging my head on pdf-generation for days now. :)  Any direction greatly appreciated!</p>