English 中文(简体)
将HTML画布作为图像复制到剪贴板
原标题:Copy HTML canvas to clipboard as image

我有一个web应用程序,我正在为一个客户端管理,该客户端使用图形库,该库使用画布生成图形。客户端希望用户能够复制网站中的任何图形,以便将其粘贴到word文档中。具体问题:

是否可以将HTML画布元素作为图像复制到剪贴板?

我知道可以将画布保存为图像,但这比复制/粘贴更麻烦。

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.

到目前为止,似乎还没有可靠的方法来复制和粘贴画布元素。

问题回答

您不能直接使用Javascript与剪贴板进行交互,但可以在Flash的帮助下进行交互。

您可以尝试http://code.google.com/p/zeroclipboard/如此处所建议如何用JavaScript复制到剪贴板

复制二进制数据可能会有问题。

另请参阅

http://danielmclaren.com/node/91





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签