title: html to pdf using pisa- Issue with using img tag
body: <p>I want to create a dynamic pdf using html in google app engine. Im using pisa to convert html to pdf. Everything except &lt; img > tag works. Even though the background-image in the css works my real need is the &lt; img > tag.</p>
  
  <pre><code>import os
  import urllib
  import unicodedata
  import logging
  from google.appengine.ext import webapp
  from google.appengine.ext.webapp import util
  from pdf_libs.pisa.ho import pisa
  
  class MainHandler(webapp.RequestHandler):
  def get(self):
      self.response.headers['Content-Type'] = 'application/pdf'
      self.response.headers['Content-Disposition'] = 'filename=mlskdf.pdf'
      html = """&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  
      &lt;style type="text/css" media="all"&gt;
          @page {
          margin: 0.5cm;
          margin-top:1.8cm;
          margin-bottom: 1cm;
          background-image: url('logo.jpg');
          @frame footer {
          -pdf-frame-content: footerContent;
          bottom: 0.5cm;
          margin-left: 0.75cm;
          margin-right: 0.75cm;
          height: 1cm;
          }
          @frame header {
          -pdf-frame-content: headerContent;
          background-color: #f4f4f4;
          top: 0.2cm;
          margin-left: 0.75cm;
          margin-right: 0.75cm;
          height: 2cm;
          }
          }
          .footer .head
          {
              position:absolute;
              left:0;
              top:4;
              width:100%;
          }
          table {
          -pdf-keep-in-frame-mode: shrink;
          }
          h1 {
              page-break-before:always;
          }
  
          div.invoice_header {
          background-color: black;
          color: #FFF;
          padding-bottom: 7px;
          text-align: center;
          }
  
          div.address_field {
          text-align: left;
          background-color: #f4f4f4;
          display: block;
          font-family: 'Ubuntu';
          font-size: 12px;
          margin-right:450px;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="invoice_header"&gt;
          &lt;label align="center" &gt;
              &lt;font face="Ubuntu" size="16"&gt;
                  HEADER
              &lt;/font&gt;
          &lt;/label&gt;
      &lt;/div&gt;
  
      &lt;br&gt;&lt;br&gt;
  
      &lt;div class="address_field" &gt;
             Another field
      &lt;/div&gt;
      &lt;table width="100%" height="100px" border="1" &gt;
          &lt;tr&gt;
              &lt;td align="center" width="50%"&gt;&lt;font face="Ubuntu" size="24"&gt;column1&lt;/font&gt;&lt;/td&gt;
              &lt;td width="25%"&gt;&lt;font face="Ubuntu" size="4"&gt;column2&lt;/font&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
      &lt;/table&gt;
      &lt;br/&gt;&lt;/br&gt;
      &lt;div id="footerContent"&gt;
            &lt;div class="footer"&gt;
          This is footer.. Page &lt;pdf:pagenumber/&gt;
            &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;"""
      pdf = pisa.CreatePDF(html, self.response.out)
      logging.info(pdf)
  
  
  
   application = webapp.WSGIApplication([
      ('/.*', MainHandler)
      ],debug=True)**
  </code></pre>
  
  <p>When i add the &lt; img > tag, i get the following error</p>
  
  <pre><code>ERROR    2014-08-06 04:53:25,903 pisa_document.py:223] Document error
  Traceback (most recent call last):
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/pisa/sx/pisa3/pisa_document.py", line 172, in pisaDocument
      doc.build(c.story)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/doctemplate.py", line 877, in build
      self.handle_flowable(flowables)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/doctemplate.py", line 762, in handle_flowable
      if frame.add(f, canv, trySplit=self.allowSplitting):
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/frames.py", line 174, in _add
      flowable.drawOn(canv, self._x + self._leftExtraIndent, y, _sW=aW-w)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/flowables.py", line 106, in drawOn
      self._drawOn(canvas)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/flowables.py", line 87, in _drawOn
      self.draw()#this is the bit you overload
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/pisa/sx/pisa3/pisa_reportlab.py", line 575, in draw
      Paragraph.draw(self)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/paragraph.py", line 970, in draw
      self.drawPara(self.debug)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/paragraph.py", line 1436, in drawPara
       dpl( tx, offset, lines[0], noJustifyLast and nLines==1)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/paragraph.py", line 307, in _leftDrawParaLineX
       _putFragLine(offset, tx, line)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/platypus/paragraph.py", line 216, in _putFragLine
       tx._canvas.drawImage(cbDefn.image,cur_x_s,cur_y+iy0,w,h,mask='auto')
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/pdfgen/canvas.py", line 825, in drawImage
      imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)
    File "/home/developer/Dropbox/File Tx Ganadev/new_project_template/pdf_libs/reportlab/pdfbase/pdfdoc.py", line 2076, in __init__
      ext = string.lower(os.path.splitext(source)[1])
    File "/usr/lib/python2.7/posixpath.py", line 105, in splitext
      return genericpath._splitext(p, sep, altsep, extsep)
    File "/usr/lib/python2.7/genericpath.py", line 91, in _splitext
      sepIndex = p.rfind(sep)
   AttributeError: PmlImage instance has no attribute 'rfind'
   ERROR    2014-08-06 04:53:25,911 webapp2.py:1528] PmlImage instance has no attribute 'rfind'
  </code></pre>