texto svg en lienzo: cómo guardar ambos como un solo 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?

preguntado el 09 de marzo de 12 a las 16:03

Do you specifically want to generate a PNG inside the browser? If you can do this on the server, inkscape will convert an SVG document to a PNG image on the command line. -

i am creating paint kind of app in browser in which i hava a canvas in the middle,i can draw on it easily and for adding text to canvas is not that good so tried <svg><text....></>.When i tried to save both of them together in on file (png or jpeg) it only takes drawing from canvas not text.This is my problem. -

1 Respuestas

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() para tal <canvas>.

Código de ejemplo:

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

respondido 10 mar '12, 11:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.