Skip to content

Lost information after reading Svg  #1170

Open
@benberlin7

Description

@benberlin7

Description

When I read a SVG with your library in Debug or Release mode from within Visual Studio everything works fine.
However after building an installation and trying it without Visual Studio some SVG data gets lost.
The input SVG is exactly the same. The elements read from that via
SvgDocument.Open(svgFilePath);
or
SvgDocument.FromSvg<SvgDocument>(File.ReadAllText(svgPath));
don't represent all the information of the SVG.

Below you can see some examples (example data). It's just the beginning of the document to show you the problem.
[A] is the SvgContent read via SvgNet in Visual Studio (Debug or Release), plotted via svgDoc.GetXML(). [B] is the exact same Svg Input read from the installation. As you can see the transforms, width, height, stroke-width and x,y values are missing.
I already checked the following:

  • both refer to the exact same Svg.DLL
  • both work on the same .NET Framework 4.8 (v4.0.30319).
  • the input SVGs are exactly the same
  • System.Drawing is in the same version
  • copied all missing DLLs from Visual Studio to the installation folder just to make sure it's not a forgotten reference
  • both have the same culture + ui-culture settings

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.

Example data

[A] SVG Content read in Visual Studio (DEBUG or RELEASE)


<?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

<?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>
(...)

Used Versions

NET Framework 4.8
SVG.net Version 3.4.7
Win 11
Visual Studio 2022 Professional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions