title: How do you insert an image using Report Lab's canvas drawImage()?
body: <p>I'm looking to expand the functionality of a tool using report lab's pdfgen which currently only draws strings using;</p>
  
  <pre><code>if json_data[definition["field"]] != "":
      c.drawString(
          definition["x"] * cm,
          definition["y"] * cm,
          json_data[definition["field"]]
  )
  </code></pre>
  
  <p>and the json;</p>
  
  <pre><code>{
      "field":"name",
      "x":1.8,
      "y":10
  },
  </code></pre>
  
  <p>So to draw images instead of strings I did the following;</p>
  
  <pre><code>if json_data[definition["field"]] != "":
      if definition.has_key("image"):
          c.drawImage(
              os.path.join(os.getcwd(), "images", "successIcon.gif"),
              definition["x"] * cm,
              definition["y"] * cm,
              width=16, height=16,
          )
      else:
          c.drawString(
              definition["x"] * cm,
              definition["y"] * cm,
              json_data[definition["field"]]
  )
  </code></pre>
  
  <p>with the json updated to;</p>
  
  <pre><code>{
      "field":"name",
      "x":1.8,
      "y":10,
      "image":"name"
  },
  </code></pre>
  
  <p>Is there something wrong with that call to <code>drawImage</code>? It looks correct according to the docs but it doesn't make it to <code>drawImage</code> because I've tried to log the args which the function gets &amp; I'm getting nothing.</p>