<html> <head> <script type="text/javascript" src="base64.js"></script> <script type="text/javascript" src="canvas2image.js"></script> <script type="text/javascript" src="html2canvas.js"></script> <script type="text/javascript" src="jquery-1.11.1.min.js"></script> </head> <body> <span id="widget" class="widget" field="AGE" roundby="20" description="Patient age, in years"> <div class="header ng-scope"> <div class="title ng-binding">TESTE1 TESTE1</div> <p class="ng-binding">TESTE TESTE TESTE TESTE</p> </div> </span> <a id="btnSave" download="mypainting.png">Download</a> <script> $(document).ready(function() { $(function() { html2canvas($("#widget"), { onrendered: function(canvas) { $("#btnSave").click(function(){ $("#btnSave").attr("href", canvas.toDataURL()); }); } }); }); }); </script> </body> </html>