[英]svg text on canvas - how to save both as a single png
I have a canvas,I draw on it and i creat svg dynamically on it to enter text.I want to save it as an image. 我有一个画布,在其上绘图,并在其上动态创建svg以输入文本。我想将其另存为图像。 I tried using xmlhttprequest using canvas.toDataURL() and file_put_content in the php code but only canvas with drawing is saved and svg text goes away?
我尝试在php代码中使用canvas.toDataURL()和file_put_content使用xmlhttprequest,但是只保存了带有绘图的画布,而svg文本消失了? Is there any way to combine both together and save as one image on disk?
有什么方法可以将两者结合在一起并保存为一个映像在磁盘上?
SVG image can be drawn on <canvas>
but there are cross-origin request concerns and only some of the latest beta browsers can do toDataURL()
for such <canvas>
. 可以在
<canvas>
上绘制SVG图像,但是有跨域请求的问题,只有某些最新的beta浏览器可以对此类<canvas>
执行toDataURL()
。
Example code: 示例代码:
https://github.com/miohtama/Krusovice/blob/master/src/tools/html2svg2canvas.js https://github.com/miohtama/Krusovice/blob/master/src/tools/html2svg2canvas.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.