title: Openlayers Print Function
body: <p>I would like to create a print button for my Openlayers map which grabs the map image and creates a nice image file.  I have tried <a href="http://dev.openlayers.org/sandbox/camptocamp/canvas/openlayers/examples/exportMapCanvas.html" rel="noreferrer">http://dev.openlayers.org/sandbox/camptocamp/canvas/openlayers/examples/exportMapCanvas.html</a>
  but it seams like it is experimental.  I have also looked at <a href="http://trac.osgeo.org/openlayers/wiki/Printing" rel="noreferrer">http://trac.osgeo.org/openlayers/wiki/Printing</a>
  but I don't want any server involved.  I also checked out <a href="http://html2canvas.hertzen.com/" rel="noreferrer">http://html2canvas.hertzen.com/</a> but can't get it to work.  I get the following error, Uncaught TypeError: Cannot read property 'images' of undefined, html2canvas.js  </p>
  
  <pre><code>&lt;button onclick="printFunction()"&gt;Click me&lt;/button&gt;
  
  function printFunction() {
  
          html2canvas(('#map'), {
              onrendered: function (canvas) {
                  var img = canvas.toDataURL("image/png")
                  window.open(img);
              }
          });
      };
  </code></pre>