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

How to export as an image?? #8

Closed
kayran opened this issue Aug 18, 2016 · 1 comment
Closed

How to export as an image?? #8

kayran opened this issue Aug 18, 2016 · 1 comment

Comments

@kayran
Copy link

kayran commented Aug 18, 2016

I tried to export as an png image drawing the svg base64 image in a canvas but the drawImage function throw a "Uncaught InvalidStateError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The HTMLImageElement provided is in the 'broken' state.(anonymous function)"

I made a img and serialize the svg to svg+xml string, and then convert it to base64. this img i pass to canvas.getContext("2d").drawImage function.

this canvas i will export with canvas.toDataUrl.

the same data:image/svg+xml;base64 open nicely in a new tab, like in http://desafio.kayran.com.br/desafio page, but the same data doesnt open im img tag and no open in canvas.

how to solve this issue?

@NPashaP
Copy link
Owner

NPashaP commented Aug 19, 2016

I am not sure what is causing the drawimage error.

Does this stackoverflow solution work?

@NPashaP NPashaP closed this as completed Feb 25, 2017
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

2 participants