简体   繁体   English

使用HTML2Canvas将Div内容捕获到图像中而不重做任何事情

[英]Capturing Div contents to image using HTML2Canvas not returing anything

I am using this code to capture an image displayed within a Div using html2canvas: 我正在使用此代码来捕获使用html2canvas在Div中显示的图像:

$(document).ready(function () {
            $('#<%= btnCapture.ClientID %>').click(function () {
                html2canvas($('#chart_div'), {
                    onrendered: function (canvas) {
                        var img = canvas.toDataURL();
                        window.open(img);
                    }
                });
            });
        });

The code works and opens a new browser window with URL something in base64, but the image is not visible. 该代码可以正常工作,并打开一个新的浏览器窗口,其中包含URL在base64中的内容,但该图像不可见。

Why the image is not visible? 为什么图像不可见?

using:"html2canvasproxy.ashx" 使用:“ html2canvasproxy.ashx”

            html2canvas($('#chart_div'), {
            "logging": true,
            "proxy": "html2canvasproxy.ashx",                    
            onrendered: function (canvas) {

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM