-
Notifications
You must be signed in to change notification settings - Fork 473
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
"Parameter is not valid" exception when document misses width and/or height #1095
Labels
Comments
I have the same crash with famous Tiger SVG image (there is "Height" defined, but no "Width"). It crashes with the latest SVG library versions 3.4.5 and 3.4.6. But version 3.4.4 works fine. |
@sla80 I have verified your issue in the latest commits. The previous report with check-mark is fixed. |
Merged
6 tasks
paulushub
added a commit
that referenced
this issue
Jan 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
SVG Library crashes with error "Parameter is not valid".
The cause is that the SVG contains an element of width 100% and height 100%, but the main document doesn't have width and height specified explicitly. This causes internally the width and height to be set to 0 and subsequently an attempt to set scaling to 0, 0 (which the Graphics class doesn't like too much).
However, the document does have viewbox defined and Inkscape seems to treat it as width and height when these attributes are missing. My suggestion is to use parameters from the viewbox as missing width and height.
After enforcing Inkscape to add missing attributes to the SVG, it is being rendered correctly by the library.
Example data
https://freesvg.org/check-mark
Attached as well.
Used Versions
Version 3.4.4 from nuget. Confirmed with master branch (as from 23.10.2023)
The text was updated successfully, but these errors were encountered: