I am working with SVG.NET in Visual Studio and trying to read the specific elements of an SVG.
When I read an SVG in debug or release mode from Visual Studio, everything works fine. However, after I create an installation and try it without Visual Studio, some SVG data is lost. The input SVGs are exactly the same. The elements created from it via
SvgDocument.Open(svgFilePath);
or
SvgDocument.FromSvg<SvgDocument>(File.ReadAllText(svgPath));
do not display all the information of the SVG.
Below you can see some examples (example data). It is just the beginning of the document to show you the problem. [A] is the SvgContent read via SvgNet in Visual Studio (Debug or Release) and plotted via svgDoc.GetXML(). [B] is exactly the same Svg input that is read by the installation. As you can see, the transforms, width, height, stroke-width and x,y values are missing. I have already checked the following:
If I read the elements in the installation via XmlDocument and log the InnerXML to a textfile the transforms etc. are displayed correctly.
I have no clue what I am missing or doing wrong.
[A] SVG Content read in Visual Studio (DEBUG or RELEASE), this is how it should be
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xml="http://www.w3.org/XML/1998/namespace" width="1122.52" height="793.7008" viewBox="0, 0, 1122.52, 793.7008">
<rect x="37.79527" y="75.59055" width="1046.929" height="680.3149" stroke-width="1.322835" fill-opacity="0" style="fill:white;stroke:black;" />
<g transform="translate(404.4094, 604.7244)">
<g>
<rect x="0" y="0" width="170.0787" height="37.79527" stroke-width="1.322835" fill-opacity="0" stroke-opacity="0" style="fill:white;stroke:white;" />
<text transform="translate(3.779528, 5.889764) translate(2, 0) translate(0, 3)" text-anchor="start" font-family="Segoe UI" font-size="10" style="dominant-baseline:hanging;fill:black;">TestText</text>
</g>
(...)
[B] the same SVG Content read from the installation, missing informations
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xml="http://www.w3.org/XML/1998/namespace" viewBox="0, 0, 1122.52, 793.7008">
<rect fill-opacity="0" style="fill:white;stroke:black;" />
<g>
<g>
<rect x="0" y="0" fill-opacity="0" stroke-opacity="0" style="fill:white;stroke:white;" />
<text text-anchor="start" font-family="Segoe UI" font-size="10" style="dominant-baseline:hanging;fill:black;">TestText</text>
</g>
(...)
NET Framework 4.8 SVG.net Version 3.4.7 Win 11 Visual Studio 2022 Professional.
Solved it : it was the missing system.numerics.vector.dll