将div内容转换为png / jpg并将其下载用户友好 [英] converting a div content to png/jpg and downloading it user friendly

查看:251
本文介绍了将div内容转换为png / jpg并将其下载用户友好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将div内容转换为图片并将其下载用户友好。

我使用以下代码

i want to convert a div content to image and download it user friendly.
im using following code for it

$("#btnimage").click(function () {
            html2canvas($("#print"), {
                onrendered: function (canvas) {
                    theCanvas = canvas;         
                    Canvas2Image.saveAsPNG(canvas);

                }
            });
        });



此代码有效,但用户下载时必须提供扩展。我需要弹出一个带有选定扩展名.PNG而不是.allfiles(*。*)的保存框。我找到了一个解决方案的PHP。但我在asp.net工作。这个plz帮助是否有任何解决方案


this code work but user have to give extension when downloading it. i need to popup a save box with selected extension .PNG instead of .allfiles(*.*) . I found one solution for php . but i m working in asp.net . Is there any solution for this plz help

推荐答案

#btnimage)。click(function(){
html2canvas(
("#btnimage").click(function () { html2canvas(


< span class =code-string> #print),{
onrendered:function(canvas){
theCanvas = canvas;
Canvas2Image.saveAsPNG(canvas);

}
});
});
("#print"), { onrendered: function (canvas) { theCanvas = canvas; Canvas2Image.saveAsPNG(canvas); } }); });



此代码有效,但用户下载时必须提供扩展名。我需要弹出一个带有选定扩展名.PNG而不是.allfiles(*。*)的保存框。我找到了一个解决方案的PHP。但我在asp.net工作。这个PLZ帮助有什么解决方法


this code work but user have to give extension when downloading it. i need to popup a save box with selected extension .PNG instead of .allfiles(*.*) . I found one solution for php . but i m working in asp.net . Is there any solution for this plz help


嘿看看下面的链接,这可能会帮到你。



http://forums.asp.net/t/1764959.aspx ?关于+ Div + Tag +转换+转换成+图像+ + c + [ ^ ]
Hey check out the below link this might help you out.

http://forums.asp.net/t/1764959.aspx?About+Div+Tag+convert+into+image+in+c+[^]


这篇关于将div内容转换为png / jpg并将其下载用户友好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆