Here is the problem,
I need to create an image file with a .svg file. I have a function which should draw the svg, and then, i get it from a canvas to save it as an image file.
my draw function is :
function drawInlineSVG(ctx, rawSVG, callback) {
var svg = new Blob([rawSVG], {type:"image/svg+xml;charset=utf-8"});
var domURL = self.URL || self.webkitURL || self;
var url = domURL.createObjectURL(svg);
var img = new Image();
img.src = url;
console.log("URL : "+url);
img.onLoad = function () {
console.log("image onload");
ctx.drawImage(this, 0, 0);
domURL.revokeObjectURL(url);
callback(this);
};
}
ctx is the canvas 2d context, rawSVG is the svg contents The console gives an url like this :
blob:http://myWebsite.net/521a72ea-3156-4290-ae16-025a8f8275bc
But the img ONLOAD never fires... so i have no callback and functions stop. I'm not working on local, so the problem does not come from getting local file...
Thanks for help!