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

"Parameter is not valid" exception when document misses width and/or height #1095

Closed
wojciechsura opened this issue Oct 23, 2023 · 2 comments · Fixed by #1131
Closed

"Parameter is not valid" exception when document misses width and/or height #1095

wojciechsura opened this issue Oct 23, 2023 · 2 comments · Fixed by #1131
Assignees
Labels

Comments

@wojciechsura
Copy link

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)

rodentia-icons_ok

@paulushub paulushub self-assigned this Dec 28, 2023
@sla80
Copy link

sla80 commented Jan 5, 2024

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.

tiger.svg.zip

@paulushub paulushub added the bug label Jan 6, 2024
@paulushub
Copy link
Contributor

@sla80 I have verified your issue in the latest commits. The previous report with check-mark is fixed.

@paulushub paulushub mentioned this issue Jan 19, 2024
6 tasks
@paulushub paulushub linked a pull request Jan 19, 2024 that will close this issue
6 tasks
paulushub added a commit that referenced this issue Jan 19, 2024
* Fixes empty path issue

- Fixes issue #1095
- Broken with: Minor optimisations (#1084) commit

* Update ReleaseNotes.md
github-actions bot pushed a commit that referenced this issue Jan 19, 2024
…amples Source Svg.Custom Tests doc docfx.json index.md license.txt Fixes empty path issue - Fixes issue #1095
 - Broken with: Minor optimisations (#1084) commit
 
 CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt Update ReleaseNotes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants