Open zllovesuki opened 7 years ago
@zllovesuki In iOS i test same thing. Please use toSvg for iOS. i am using same code for iOS. I am using this code. It's working fine for me.
var node = document.getElementById('game1-screen');
domtoimage.toSvg(node)
.then(function (dataUrl) {
var img = new Image();
img.src = dataUrl;
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
canvas.width = 500;
canvas.height = 300;
ctx.drawImage( img, 0, 0);
document.body.appendChild('<img src="'+canvas.toDataURL( "image/png" )+'" />');
}
Thanks Avanish Kumar LinkedIn
WebKit and IE blocked .toDataUrl()
if you have <foreignObject>
in the canvas, which is what dom-to-image
has. Still trying to figure out a workaround.
@zllovesuki In iOS i test same thing. Please use toSvg for iOS. i am using same code for iOS. I am using this code. It's working fine for me.
var node = document.getElementById('game1-screen'); domtoimage.toSvg(node) .then(function (dataUrl) { var img = new Image(); img.src = dataUrl; var canvas = document.createElement( "canvas" ); var ctx = canvas.getContext( "2d" ); canvas.width = 500; canvas.height = 300; ctx.drawImage( img, 0, 0); document.body.appendChild('<img src="'+canvas.toDataURL( "image/png" )+'" />'); }
Thanks Avanish Kumar LinkedIn
not work when image too large .
@FrankRoc at this point I think we are better off using remote server instead of client html.
Probably related to tsayen/dom-to-image#74