Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dom-to-image doesn't work on iOS #17

Open
zllovesuki opened this issue Mar 4, 2017 · 4 comments
Open

dom-to-image doesn't work on iOS #17

zllovesuki opened this issue Mar 4, 2017 · 4 comments

Comments

@zllovesuki
Copy link
Owner

Probably related to tsayen/dom-to-image#74

@AvanishKumar008
Copy link

@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

@zllovesuki
Copy link
Owner Author

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.

@FrankRoc
Copy link

@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 .

@zllovesuki
Copy link
Owner Author

@FrankRoc at this point I think we are better off using remote server instead of client html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants