如何在word文档中使用jquery.The div下载一个div格式的图片
here is my div.
<div id="genealogy" class="genealogy">
</div>
am trying like that.But it displays only text that present in the image not the image.
$("#export").click(function(event) {
$("#genealogy").wordExport();
});
发布于 2015-09-25 12:11:22
您可以使用此jsfiddle作为如何执行此操作的示例:
$(function() {
$("#btnSave").click(function() {
html2canvas($("#widget"), {
onrendered: function(canvas) {
theCanvas = canvas;
document.body.appendChild(canvas);
// Convert and download as image
Canvas2Image.saveAsPNG(canvas);
$("#img-out").append(canvas);
// Clean up
//document.body.removeChild(canvas);
}
});
});
}); 它所依赖的.js文件也可以在该jsfiddle上找到。
只需小心浏览器支持即可。
您可以修改该代码以获取字节数组/blob形式的PNG,然后使用officegen生成文档。
https://stackoverflow.com/questions/32774655
复制相似问题