How to take convert a webpage to a image in javascript / Google web tool kit
I have a requirement to convert a webpage into a image. When a user clicks
a button the new window need to display the webpage as a image.
IS it possib开发者_如何转开发le to do in Javascript or Google web tool kit?
Take a screenshot of a webpage with JavaScript?
Firefox has a "drawWindow" method on the canvas element that lets you copy a screenshot of the window into a canvas element (from where it can then be extracted). This is however not enabled for webpages (only for add-ons), because it forms a security risk: http://mxr.mozilla.org/mozilla/source/content/canvas/src/nsCanvasRenderingContext2D.cpp#2352
In short, plugins (or activex components) are the only sure way to go. Browsers aren't going to provide this as standard functionality because the risks outweigh the benefits.
精彩评论