Is there a way to do this without any exe files or 3rd party things? I cannot use windows form components in web application and I am in need of taking screenshots of different URLs programmatically. Any idea will be appreciated.
没有任何exe文件或第三方的东西有没有办法做到这一点?我无法在Web应用程序中使用Windows窗体组件,我需要以编程方式截取不同URL的屏幕截图。任何想法将不胜感激。
1 个解决方案
#1
1
Similar question here: Using HTML5/Canvas/JavaScript to take screenshots
类似的问题:使用HTML5 / Canvas / JavaScript截取屏幕截图
JavaScript can read the DOM and render a fairly accurate representation of that using canvas. I [@Niklas] have been working on a script which converts html into an canvas image.
JavaScript可以读取DOM并使用画布呈现相当准确的表示形式。我[@Niklas]一直致力于将html转换为画布图像的脚本。
See also: http://html2canvas.hertzen.com/
另见:http://html2canvas.hertzen.com/
Edit:
编辑:
Note: You will need to write a web service/web method that accepts a base64 encoded string as an input parameter, and then saves that string (in its raw form, or converted to a file.)
注意:您需要编写一个Web服务/ Web方法,该方法接受base64编码的字符串作为输入参数,然后保存该字符串(以其原始格式或转换为文件)。
Example usage of html2canvas:
html2canvas的示例用法:
var imageAsBase64;
$('body').html2canvas({
onrendered: function(canvas) {
imageAsBase64 = canvas.toDataURL();
// You now have a base64 string, representing a "screenshot" of
// your <body> element, which you can POST to your web service.
}
});
#1
1
Similar question here: Using HTML5/Canvas/JavaScript to take screenshots
类似的问题:使用HTML5 / Canvas / JavaScript截取屏幕截图
JavaScript can read the DOM and render a fairly accurate representation of that using canvas. I [@Niklas] have been working on a script which converts html into an canvas image.
JavaScript可以读取DOM并使用画布呈现相当准确的表示形式。我[@Niklas]一直致力于将html转换为画布图像的脚本。
See also: http://html2canvas.hertzen.com/
另见:http://html2canvas.hertzen.com/
Edit:
编辑:
Note: You will need to write a web service/web method that accepts a base64 encoded string as an input parameter, and then saves that string (in its raw form, or converted to a file.)
注意:您需要编写一个Web服务/ Web方法,该方法接受base64编码的字符串作为输入参数,然后保存该字符串(以其原始格式或转换为文件)。
Example usage of html2canvas:
html2canvas的示例用法:
var imageAsBase64;
$('body').html2canvas({
onrendered: function(canvas) {
imageAsBase64 = canvas.toDataURL();
// You now have a base64 string, representing a "screenshot" of
// your <body> element, which you can POST to your web service.
}
});