- From: alexsong19 <notifications@github.com>
- Date: Wed, 13 Nov 2019 10:41:38 -0800
- To: w3c/clipboard-apis <clipboard-apis@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 13 November 2019 18:41:40 UTC
On windows, I can copy svg content to clipboard, with mime type 'image/svg+xml', and then paste to other programs as a vector graph. On mac os, this doesn't seem to work. In mac os clipboard, the file type would become 'unkonwn'. An example python code is as follows, I use `matplotlib` to generate a svg graph, then use `PyQt` to send it to clipboard: ``` import io import numpy as np from PySide.QtGui import QApplication, QImage from matplotlib import pyplot as plt import matplotlib as mpl mpl.use('Qt5Agg') # or Qt4Agg # do a matplotlib plot fig = plt.figure() plt.plot(np.arange(10), np.arange(10)) # this saves the plot as svg to clipboard buf = io.BytesIO() fig.savefig(buf, format='svg') data = QtCore.QMimeData() data.setData('image/svg+xml', buf.getvalue()) QApplication.clipboard().setMimeData(data) ``` This works on windows but not on mac. Is this because mac osx clipboard doesn't recognize 'imag/svg+xml'? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/clipboard-apis/issues/105
Received on Wednesday, 13 November 2019 18:41:40 UTC