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
SVG <img> is massive #1803
Comments
I attached a Fiddle, which I hope makes this clear: http://jsfiddle.net/1b4mLnfj/2/ |
Thanks, i'll look into it |
I've been poking around this for a while and it seems like the container bounds are being calculated correctly but the vector image itself is adopting the dimensions of the viewport. It seems like the bounds and curvedBounds are all right, so I'm not sure where to make changes... Anyone run into an issue like this before? |
After more investigation, it looks like this is only happening with svg images that are "responsive" -- if you open the svg in Illustrator and save without the responsive option checked, it will size correctly... essentially if the svg doesn't have a height and width encoded in it (what Illustrator called "responsive") then it will adopt the dimensions of the viewport. |
So one potential solution is to replace the There are a few drawbacks to this (like when using encoded, base64 src's, or if you have multiple svg's with the same structure and inline class styling) but maybe this will help someone else struggling with the issue. I've been working on this steadily for a few days now and this is the best solution I have so far. I can't find anything the the actual |
So I'm throwing-in the towel on this one but I landed on the solution being related to how the svg is rendered / drawn on the canvas. Specifically, in |
any update here? |
Not from me, I've stopped working on the issue but hopefully the comments above could be helpful. |
Hi i had the same issue. |
Thanks for this issue. I could solve it by loading the SVG inline (). |
I was able to solve this by setting the
to this
and it worked! |
Please make sure you are testing with the latest release of html2canvas.
Old versions are not supported and issues reported for them will be closed.
Please follow the general troubleshooting steps first:
Bug reports:
If I use
<img src="... .svg">
the svg is super blown up. This appears to only happen with "responsive" svg images (images where no height or width has been set in the actual image encoding). The image and contentBox are rendered with the correct size but the when drawn on the canvas, the image adopts the viewport height.Here's the Fiddle: http://jsfiddle.net/1b4mLnfj/2/
Specifications:
The text was updated successfully, but these errors were encountered: