Skip to content

Instantly share code, notes, and snippets.

@tingwei628
Last active September 16, 2015 06:19
Show Gist options
  • Save tingwei628/9277c8026c5be92fb80e to your computer and use it in GitHub Desktop.
Save tingwei628/9277c8026c5be92fb80e to your computer and use it in GitHub Desktop.
Html converts to img (將html 輸出成img格式)
<!--baseURL 就是 輸出的img src 連結-->
<!--該Html 引用<script type="text/javascript" src="http://html2canvas.hertzen.com/build/html2canvas.js"></script>-->
<!--Ext.getCmp('wincv-1110').el.dom ,即是該html的DOM-->
<!--參考 html2canvas : http://html2canvas.hertzen.com/-->
<script type="text/javascript" src="http://html2canvas.hertzen.com/build/html2canvas.js"></script>
<script>
html2canvas(Ext.getCmp('wincv-1110').el.dom,{onrendered:function(canvas){
var baseURL = canvas.toDataURL("img/png");
console.log(baseURL);
}});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment