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.
Asked
Active
Viewed 787 times
1
-
of course not :D i mean web page but not current one – Kuzgun Jan 03 '13 at 09:43
-
Then I am confused. Do you mean a rendered webpage at that URL? Using which renderer? Here is what this page looks like in w3m: http://imgur.com/PXm5f , for instance. – johnsyweb Jan 03 '13 at 09:48
-
I just need a simple thumbnail like how we see in browser :) like this one: http://beta.thumbalizr.com/app/thumbs/?src=/thumbs/onl/source/e8/e847d6948f57c012bea2d7eedbdb6914.png&w=150&q=0&enc= – Kuzgun Jan 03 '13 at 09:55
-
Ahh, so you require a thumbnail of an external web page? What's wrong with the thumbalizr API you mention? e.g. http://api.thumbalizr.com/?url=http://www.ford.de&width=250 gives you the thumbnail for http://www.ford.de . – Merenzo Jan 03 '13 at 23:31
1 Answers
1
Similar question here: Using HTML5/Canvas/JavaScript to take screenshots
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.
See also: 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.)
Example usage of 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.
}
});
-
Wouldnt it cause a security problem? Because I also need to save the image. – Kuzgun Jan 03 '13 at 09:37