I have successfully used this technique, to draw user input from DOM elements (such as input and selection fields) on a canvas and make it available as an image.
This works fine in Chrome, Safari and Firefox, but on Internet Explorer 11 , I get the following error:
ctx.drawImage()
is called.Essentially, what I am trying to do in this fiddle is to draw the SVG yellow circle image and an arbitrary SVG, provided by me, on the canvas. This seems to work in all major browsers except IE11. Is there anyone else having faced the same problem and knows some workaround?
To draw SVG onto canvas, you need to use SVG image. Firstly, use the <foreignObject> element which contains the HTML. After that, you need to draw the SVG image into the canvas.
IE 10 did not support <foreignObject>
tag, but you did not need it to draw text on canvas, here i rewrite you fiddle, so now it works in IE - http://jsfiddle.net/skyr9999/5hhpo76h
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With