-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Cannot draw SVG on the html canvas #1543
Comments
Pretty sure SVG is not supported, I had to use https://github.com/canvg/canvg to first convert all SVG to canvas and then print it out. You can also take a look at this example. http://rahulgaba.com/front-end/2016/07/14/generating-pdf-using-jspdf-and-html2canvas.html |
Hmmm, I'm using html2canvas together with svg's. I don't have any problems with it. |
Could you copy me your SVG file? As my issue described, it works in Safari browser, but doesn't work in Chrome. Thank you. |
@LanderBeeuwsaert |
Hey, not too familiar with jsfiddle, so if you prepare the dependencies for me in jsfiddle and then send me the link so I can complete (only have to replace the svg with my svg) I'd be happy to. |
I can not capture this.
But I can capture this svg.
I just add width and height. |
Experiencing similar issues here. Inline SVGs not rendered into canvas. In Safari it seems to work fine, but only if all properties are included inline within the SVG. So if you're adding your dimensions, fill, stroke, etc. through CSS stylesheet, they won't show up and it won't work. In Chrome and in Firefox, I cannot get it to render inline SVGs at all. Strange. Update: when enabling ForeignObjectRendering as an option, Chrome now renders the SVG but they're in the wrong place, and for some reason this also had the affect of forcing text into a different font. In Firefox, enabling this throws this error: |
My svg is rendering, but get a bit offset (about 150 px) |
Looking through this issue ,I encountered a solution online.it is at https://jsfiddle.net/oz3tjnk7. Note ,it does not contain the use of this library ,but a vanillas implementation https://jsfiddle.net/oz3tjnk7/ |
@richardhovdsveen any chance you solved the SVG offset issue? my SVGs are also rendered by about that many pixels as well. |
@george-wb Ended up with calculating the difference when it appeared. At least thats what I remember :) |
Description
I'm trying to draw a SVG image (please see code.html.txt) on the html canvas, using html2canvas v1.0.0-alpha.12. But, not successful.
The html2canvas might not support all kinds of SVG elements in Chrome browser, I guess. I'm not sure that this is a Chrome security restriction, or a html2canvas fault. This has blocked my work.
Oops... :(
Specifications:
The text was updated successfully, but these errors were encountered: