admin管理员组文章数量:1405603
I have a web application I'm administering for a client which uses a graphing library which generates graphs using a canvas. The client wants the user to be able to copy any graph in the site so that it can be pasted into a word document. The specific question:
Is it possible to copy an HTML canvas element to the clipboard as an image?
I know that it is possible to save a canvas as an image, but it's somewhat more cumbersome than copy/paste.
EDIT: I've learned that you can convert the canvas over to an image with a data URI src, but the copy and paste support on that image is mixed. Firefox allows you to copy and paste these images out of a browser, but chrome doesn't.
As of right now, it appears that there is not a reliable way to copy and paste a canvas element.
I have a web application I'm administering for a client which uses a graphing library which generates graphs using a canvas. The client wants the user to be able to copy any graph in the site so that it can be pasted into a word document. The specific question:
Is it possible to copy an HTML canvas element to the clipboard as an image?
I know that it is possible to save a canvas as an image, but it's somewhat more cumbersome than copy/paste.
EDIT: I've learned that you can convert the canvas over to an image with a data URI src, but the copy and paste support on that image is mixed. Firefox allows you to copy and paste these images out of a browser, but chrome doesn't.
As of right now, it appears that there is not a reliable way to copy and paste a canvas element.
Share Improve this question edited Jun 2, 2011 at 21:40 Brad Koch asked May 28, 2011 at 20:40 Brad KochBrad Koch 20.4k20 gold badges112 silver badges140 bronze badges 2- You might consider HTML5 drag-out for Chrome (slides.html5rocks./#drag-out), which might allow you to drag and drop the image from your browser to a Word document. – Jeff Commented Jun 2, 2011 at 21:45
- 1 Also, if you copy an canvas-to-image from Chrome, you can paste into Word using 'paste special' – Jeff Commented Jun 2, 2011 at 21:56
1 Answer
Reset to default 2You cannot interact with clipboard directly with Javascript, but it could be possible with help of Flash.
You could try http://code.google./p/zeroclipboard/ as suggested here How do I copy to the clipboard in JavaScript?
Copying binary data could be problematic thou.
See also
http://danielmclaren./node/91
本文标签: javascriptCopy HTML canvas to clipboard as imageStack Overflow
版权声明:本文标题:javascript - Copy HTML canvas to clipboard as image - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744282543a2598723.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论