简体   繁体   中英

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. 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? 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> .

Example code:

https://github.com/miohtama/Krusovice/blob/master/src/tools/html2svg2canvas.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM