Try converting SVG to canvas with fabric.js (here's a demo, in which svg is converted to canvas in real time, when you click on a button in sidebar).
Fabric doesn't support all SVG features but it should work for simple cases.
Here's an example of using loadSVGFromURL
.
1) You'll need to have <canvas> element:
<canvas id="my-canvas"></canvas>
2) Initialize fabric.Element
out of the canvas:
var canvas = new fabric.Element('my-canvas');
3) Fetch SVG via XHR:
canvas.loadSVGFromURL('path_to_your_shape.svg', function(objects, options) {
// `objects` is now an array of fabric objects representing
// svg shapes from the document
// if it's one shape, we'll just work with that
// if it's more than one — we'll create a unified group out of it,
// using `fabric.PathGroup`
var loadedObject = objects.length > 1
? new fabric.PathGroup(objects, options)
: objects[0];
// we can now change object's properties like left, top, angle, opacity, etc.
// this is not necessary, of course
loadedObject.set({
left: 123,
top: 321,
angle: 55,
opacity: 0.3
});
// and add it to canvas
canvas.add(loadedObject);
});