Is it possible to fetch a rectangular section of a web-page as an image via JavaScript? [duplicate]
Possible Duplicate:
Take a screenshot of a webpage with javascript?
I'm developing an interactive HTML page and am looking for a way to capture an arbitrary portion of this page into a dataURI (Base64 encoded PNG).
I know its possible to get this for a canvas element but do modern browsers provide any way to do this for an arbitrary section of the page?
Not without sending it off server-side.
You could send an AJAX request to your server with some parameters (url, anchor, offset dimensions etc) and return a base64 string of the captured image.
Here's an example of capturing an image server-side using C#, there should be examples in other languages as well.
精彩评论